#include #include #include int main (int argc, char **argv) { char *name[7] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"}; char **string_ptr; int i; int arr[10][12]; int *whatever; whatever = arr[6]; /* legal */ /* arr[6] = whatever; illegal */ arr[6][5] = 47; /* legal */ /* string_ptr = "hello"; legal but a bad idea! */ string_ptr = (char **)calloc(10, sizeof(char *)); string_ptr = &name[0]; /* or equivalently string_ptr = name; */ /* other_name = "hello"; */ /* name[0] = malloc(7); strcpy (name[0], "Sunday"); */ name[0] = name[1] = "Snarkday"; /* name[1] = "Sunday"; name[2] = "Tuesday"; name[3] = "Wednesday"; etc. */ /* other_name[0] = "hello"; */ name[1][0] = 'M'; name[1][1] = 'o'; for (i = 0; i<7; ++i) printf ("name[%d] = %s\n", i, string_ptr[i]); /* printf ("Another day is %s\n", name[4]); */ /* printf ("other_name is %s\n", other_name); */ for (i=0; i