Solution for Exercise 12-20
ex1220
#include <stdio.h> int main() { int const size = 6; char caesar[size][9] = { "Julius", "Augustus", "Tiberius", "Caligula", "Claudius", "Nero" }; int x; for(x=0;x<size;x++) puts(caesar[x]); return(0); }
Output
Julius
Augustus
Tiberius
Caligula
Claudius
Nero
Notes
* I hope you remembered to change the size
constant at Line 5.
* I added the new names in chronological order.
* Fortunately, none of the emperor's names is longer than 8 characters. Otherwise, you need to change the value of the caesar[]
array's second dimension to match the length of that string, plus one for the null character..
Copyright © 1997-2024 by QPBC.
All rights reserved