char type
char is a numerical type, but its main use is to represent characters, not
numerical work. C provides a wide range of character literals which
return the numerical value of a character (usually the ASCII code).
Character literals are enclosed in apostrophes, for example:
|
char c = 'H'; |
c the numerical value of the character H.
Since char is an integer type and C will convert between numerical
types quite readily, the following are perfectly legal
|
int i = 'H'; double f = 'c'; i = 'K' * 67.57; |
int rather than a char, but this difference is not normally
important). The newline, horizontal and vertical tab and form-feed
characters, together with the space character are known collectively
as whitespace.