Which of the following are valid characters constants? A. ‘\n’ B. ‘\\’ C. ‘\0’ D. All of the above E. None of the above

' '
'\'
''
All of the above E. None of the above

The correct answer is: D. All of the above

A character constant is a sequence of one or more characters enclosed in single quotes (‘). The characters inside the single quotes are literally represented in the program.

The following are valid character constants:

  • ‘\n’: A newline character.
  • ‘\’: A backslash character.
  • ‘\0’: A null character.

A null character is a character with all bits set to zero. It is used to mark the end of a string.