/* string2.c author: Mark Stehlik purpose: to demo - 2-D array of char */ #include #include #include #define ROWS 3 #define COLS 5 int main(int argc, char *argv[]) { char matrix[ROWS][COLS]; /* what does memory look like? */ int i; scanf("%s", matrix[1]); /* if the user enters "cat", what happens? */ strcpy(matrix[2], "dog"); /* and now? */ for (i = 0; i < ROWS; i++) printf("string in row %d: %s\n", i, matrix[i]); return 0; }