Get Address of an array using Arrays and Pointers


Levels of difficulty: / perform operation:

Program

#include <stdio.h>

int main(void)
{
  char multiple[] = "My string";

  char *p = &multiple[0];
  printf("\nThe address of the first array element  : %p", p);

  p = multiple;
  printf("\nThe address obtained from the array name: %p\n", p);

  return 0;
}

Result

The address of the first array element  : 9a372
The address obtained from the array name: 9a372