Saturday, 12 March 2016

Declare an array of char and initialize it to the string "cheeseburger".

Leave a Comment

Question:

Declare an array of char and initialize it to the string "cheeseburger".

Answer:

char lunch[13] = "cheeseburger"; // number of characters + 1
or
char lunch[] = "cheeseburger";  // let the compiler count elements

Source:

C++ Primer Plus Sixth Edition Chapter Review

If You Enjoyed This, Take 5 Seconds To Share It