Today to summarize the char type, the usual writing algorithm for this thing feel a bit around, in the final analysis or this part of the knowledge is not familiar with so a little afraid of him, but do not be afraid, today to summarize
First, when it comes to character data types, char type, well, it's a data type.
Then, it's the character variable .
The emphasis of a character variable is to store a character in a character variable, not the shape of the character, but the ASCII code of the character.
Input: GetChar ();
Output: Putchar ();
The difference between GetChar and scanf is that he can enter spaces
Character-type constants:
1. General
A
2. Escaping
1. ' \ t '
Slash + character
2. ' \ ' + character Anscii code,
\DDD octal corresponding characters
String constants:
"ABDF"
The difference between ' a ' and ' a '
Note:: There are no string variables, only string constants exist
Storing a string requires a character array
Character array:
Char A[5]
1. Initialization of character arrays
1. Class with character constants
Char a[8]={' C ', ' h ', ' I ', ' n ', ' a '}
If not initialized, the values of the elements of the array are random
2. If partially initialized, the following automatic null character
2. Class with a string constant.
Char a[8]={"China"};
Char a[8]= "China";
' !!!! The assignment operation must never use a string constant, but can be used to assign a value to a character constant
Char a[100];
A[100]= "ABC" is wrong.
2.
A man of Love and Hate char (character type)