Multiple choice technology programming languages

If char catname[15]; , which of the following is valid?

  1. catname[15] = "Millie";

  2. catname = "Millie";

  3. catname[ ] = "Millie";

  4. None are Valid

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

In C, you cannot assign a string literal directly to a character array after declaration using the assignment operator. catname[15] is out of bounds, catname = "Millie" tries to assign to an array name pointer, and catname[] is syntax error. None are valid.