#include int main (void) { /* * Arrays in C are just sequential data items * stored in a memory location * The address of the array, is the same as the first * element in the array * The name of the array is also the address of the array. */ char str1[] = "Hello cruel world"; /* \0 is automatically added */ /* Those variables look the same, but they are not. */ /* This is an array */ /* * str2, is the address of the "ARRAY" which the characters * of the string are stored * str2 is not a 'pointer' to the location of the Hello char array * str2 IS THE LOCATION of the array. */ char str2[] = "Hello"; /* * This is a pointer. * * Whose value is not the string, but the - address of that string - * */ char *str3 = "Goodbye"; str3 = NULL; str2 = NULL; /* * &str1, &str1[0] and str1, all points to the very same address. * * The array name, str1, is also the address of the array. * */ printf("%s, %c, %d, %d %d\n", str1, str1[0], &str1, &str1[0], str1); printf("%p %p %s\n", &str2, str2, str2); printf("%p %p %s\n", &str3, str3, str3); }