A character is a letter, numeral or special symbol, which can be handled by the computer
system.These available symbols define the system's character set.Enclosing a single character
from the system's character set within single quotation marks forms a character constant. The
characters used in C language are grouped into three classes .
eg:
'1'.'a','+', and '-' are the valid character constants.
since two single quotes are used to represent the character constant, how do we represent the
single quote itself as a character constant? It is not possible to represent a single quote character
enclosed between two single quotes, that is, the representation ''' is invalid.
An escape sequence maybe used to represent a single quote as a character constant. Character
combinations consisting of a backslash \ followed by a letter are called escape sequences.
'\'' is a valid single quote character constant .
similarly some non printable character are represented using escape sequence characters.
eg:
'\a' bell(beep)
'\b' backspace
'\f' forum feed
'\r' carriage return
'\n' newline
'\0' null character
'\t' gap
To represent the backslash itself as a character, two backslashes are used('\\')
system.These available symbols define the system's character set.Enclosing a single character
from the system's character set within single quotation marks forms a character constant. The
characters used in C language are grouped into three classes .
- Alphabetic characters (a,b,c,....z A,B,C,......Z)
- Numeric characters (0 through 9)
- Special characters (+ - * / % # = ,=.=' " () [] : )
eg:
'1'.'a','+', and '-' are the valid character constants.
since two single quotes are used to represent the character constant, how do we represent the
single quote itself as a character constant? It is not possible to represent a single quote character
enclosed between two single quotes, that is, the representation ''' is invalid.
An escape sequence maybe used to represent a single quote as a character constant. Character
combinations consisting of a backslash \ followed by a letter are called escape sequences.
'\'' is a valid single quote character constant .
similarly some non printable character are represented using escape sequence characters.
eg:
'\a' bell(beep)
'\b' backspace
'\f' forum feed
'\r' carriage return
'\n' newline
'\0' null character
'\t' gap
To represent the backslash itself as a character, two backslashes are used('\\')
No comments:
Post a Comment