So I'm in this class, and I can't seem to find anyone that can explain this. I've taken C, I believe I have a pretty good grasp on pointers, but on my review for data structures it has these 2 "programs" and asks what each output is. Let me know if you can explain it to me as I seem to be at a loss for what they are doing. This is for a test review, not for any homework.
andCode:#include <stdio.h> int main (void) { int a[5] = {5,4,3,2,1}; int i = 2; int *p = &a[2]; printf("%d %d", *(a+i), p[3]); system("pause"); }
Thanks for any input, they both do compile, however I'm pretty sure the first one is drawing some random memory address as its like a 6 digit number.Code:#include <stdio.h> int main (void) { int a[5] = {5,4,3,2,1}; printf("%d %d", *a, a[4]); system("pause"); }
XI Wiki


