How are character constants represented in the C language?
In C language, character constants can be enclosed in single quotes (‘) to represent characters. For example:
- Character ‘A’ represents the letter A.
- ‘9’: indicates the character 9
- ‘\n’ : represents a line break
- ‘\’ is used to represent a backslash.
- ” represents single quotation mark
- ” ” : indicate double quotation marks.
- ‘\t’ is used to indicate a tab character.
- ‘\0’ indicates a null character, which marks the end of a string.
It is important to note that character constants can only contain a single character. If you need to represent a string, you should use double quotation marks to enclose multiple characters, for example: “hello”.