Multiple choice

The declaration char flag[]=”TRUE” will result in

  1. flag is a one dimensional, 4 element, character array;

  2. flag is a one dimensional, 5 element, character array;

  3. flag is a one dimensional character array containing TRUE or FALSE

  4. the declaration is wrong

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

The string literal 'TRUE' contains 4 visible characters (T, R, U, E) plus a null terminator ('\0') which C automatically adds at the end of string literals. This makes flag a 5-element character array. The null terminator is essential for C strings to work properly with string functions.