Character and string
A character is a letter, number, punctuation, or other such symbol; a string is a sequence of any character.
Strings are used to store text data consisting of letters, numbers, punctuation marks, and other symbols.
The C language uses the char data type to store old characters. Char is an integer value type.
C-language character storage: in computer memory, all data is stored in numeric mode.
Characters cannot be stored directly, but each character has a corresponding numerical encoding.
This encoding is called an ASCII code or an ASCII character set.
In this encoding, each uppercase/lowercase letter, number, punctuation, and other symbols correspond to a 0 ~ 255 value.
# Include
Void main () {char a1 = 'a'; char a2 = 90; // Note: to print a string, use % cprintf ("\ n to print a = % c ", a1); // Note: To print ASCII, use % dprintf ("\ n to print the ASCII code of a: % d", a1 ); printf ("\ n print a2: % c", a2); printf ("\ n print a2's ASCII: % d", a2 );}
Running result:
# Include
Void main () {// print 26 English characters printf ("26 English case:"); for (int I = 65; I <= 122; I ++) {printf ("\ n % c", I);} system ("pause ");}
Running result: