What does C++ append to the end of a string literal constant? A. a space B. a number sign (#) C. an asterisk (*) D. a null character

[amp_mcq option1=”a space” option2=”a number sign (#)” option3=”an asterisk (*)” option4=”a null character” correct=”option4″]

The correct answer is: D. a null character.

A string literal constant is a sequence of characters enclosed in double quotes. The compiler automatically appends a null character to the end of a string literal constant. This null character is not visible in the source code, but it is stored in memory and used to terminate the string.

The other options are incorrect. A space is a whitespace character, and it is not appended to the end of a string literal constant. A number sign (#) is a preprocessor directive, and it is not used to append anything to a string literal constant. An asterisk (*) is a wildcard character, and it is not used to append anything to a string literal constant.

Exit mobile version