I was reading about pointers when suddenly I thought that if pointer is nothing but a variable that stores memory address of a variable so every integer should work as a pointer. Then I created a small program, it gave warning but it somehow worked.
int main()
{
int i,j;
i=3;
j=&i;
printf("%d\n%d\n%d",i,j,&i);
return 0;
}
Output was
3
1606416600
1606416600
So, why to put an extra * if normal int does the work?
Another question is about the output to following program
int main()
{
int a[] = {1,2,3,4,5,6,7};
int *i,*j;
i=&a[1];
j=&a[5];
printf("%d\n%d\n%d",j,i,j-i);
return 0;
}
Output :
1606416580
1606416564
4
Why is j-i = 4 and not 16?