Solution for Exercise 12-19
ex1219
#include <stdio.h> #define SIZE 3 int main() { char president[SIZE][8] = { "Clinton", "Bush", "Obama" }; int x,index; for(x=0;x<SIZE;x++) puts(president[x]); return(0); }
Notes
* The array item president[x]
represents a string in a two-dimensional array. That's just about the only time you'll get away with that trick. It's due to the nature of arrays and how strings are handled in the C language. Don't try it with an int array!
Copyright © 1997-2024 by QPBC.
All rights reserved