Mega Code Archive

 
Categories / C Tutorial / Array
 

Arrays and pointers

#include <stdio.h> int main(void) {   char multiple[] = "a string";   char *p = multiple;   int i;   for(i = 0 ; i<strlen(multiple) ; i++)     printf("\nmultiple[%d] = %c  *(p+%d) = %c  &multiple[%d] = %p  p+%d = %p",                        i, multiple[i], i, *(p+i), i, &multiple[i], i, p+i);   return 0; } The address of the first array element : 9a372 The address obtained from the array name: 9a372