0

Why do both of them print the same address? As per my understanding, 'a' is a pointer to the first location of the array i.e value of 'a' is the address of first location of array.

With j=a, we are copying the value of first location of array to j. But &a refers to the address of 'a' which should be distinct from the value in 'a'.

#include <stdio.h>

int main()
{
int a[2]={1,2}, *j;
j = a;
printf("%u\n", j);
printf("%u\n", &a);
}

/*OUTPUT:

1356487632
1356487632

*/
sheetal_158
  • 7,391
  • 6
  • 27
  • 44

0 Answers0