Search code examples
carrayspointerspointer-to-array

What will be the value in the below cases?


If I define an array arr[] and define a pointer to it:

int *p=arr;

If the value of arr (in terms of address) is 0x1234. What will be the value of p? Will it be the same?


Solution

  • Yes. The value is the same. To check this, just try

    printf("arr=%p p=%p\n", arr, p);