I have assignment to find output of the source:
Code:
int a[7]={81,12,35,97,40,52,17}, *pa, x, y;
pa=a+3;
x=*(pa-2)+1;
y=(*pa-2)+1;
So I got in CodeBlocks and did this program:
Code:
#include <stdio.h>
int main()
{
int a[7]={81,12,35,97,40,52,17}, *pa, x, y;
pa=a+3;
x=*(pa-2)+1;
y=(*pa-2)+1;
printf("\nValues are:\nx=%d\ny=%d\npa=%d",x,y,*pa);
return 0;
}
The output was: x=13, y=96, pa=a+3 (its required to present it with a+ number). Problem is, I don't know how are those values calculated and if someone can explain it, it would be gr8.
Edit 1: PS: Wondering if someone could tell me how can i determine size of pointer to int. I was using printf("%d",sizeof(int)); to get size of integer but how to do it if I want to see size of int *a ?