Multiple choice

char * dwarves [] = { Sleepy, Dopey Doc, Happy, Grumpy Sneezy, Bashful, }; How many elements does the array declared above contain? Assume the C compiler employed strictly complies with the requirements of Standard C.

  1. 4

  2. 5

  3. 6

  4. 7

  5. 8

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

The array initialization contains 6 strings separated by commas: 'Sleepy', 'Dopey Doc', 'Happy', 'Grumpy Sneezy', 'Bashful'. Wait, the list is: Sleepy, Dopey Doc, Happy, Grumpy Sneezy, Bashful. That is 5 elements.