Solution for Exercise 12-19
ex1219
#include <stdio.h> int main() { int const size = 3; char caesar[size][9] = { "Julius", "Augustus", "Nero" }; int x; for(x=0;x<size;x++) puts(caesar[x]); return(0); }Output
Julius
Augustus
NeroNotes
* The compiler may warn you if you forget to remove the unused variable
index
.* The array item
caesar[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