Solution for Exercise 12-20
ex1220
#include <stdio.h> #define SIZE 6 int main() { char president[SIZE][11] = { "Washington", "Adams", "Jefferson", "Clinton", "Bush", "Obama" }; int x,index; for(x=0;x<SIZE;x++) puts(president[x]); return(0); }
Notes
* I hope you remembered to change the SIZE
constant at Line 3.
* Changing the size of the array's second dimension is also important: Washington
has 10 letters, which means you need 11 characters to store that name.
Copyright © 1997-2024 by QPBC.
All rights reserved