63.0k views
2 votes
Which of the following lines of code defines an array of C-strings that will hold 49 characters and the null terminator? a char (49) b. char str[50]: C. char[50] str. d. character str[50]; e. None of the above

User Ecarlin
by
7.8k points

1 Answer

3 votes

Answer: B

Step-by-step explanation:

The first option states the data type but does not define the variable, not to mention it doesn't have brackets.

The second option is correct, because it states the data type, defines the variable and the size of the array.

The third option doesn't put the correct size for the variable "str"

the fourth option states "character" which is an invalid datatype.

User Hovanes Mosoyan
by
7.5k points