- The character type is actually the int type, and the way to save it is to put the ASCII code of the character. The char type is actually a short type.
- The single quotation mark includes a character, and the double quotation mark includes a string.
- Dividing the number of shaping numbers, this operation will perform the rounding, for example: 5/9, should be approximately equal to 0.5555, but due to the bit, the final value is 0. If you need to preserve the decimal place, first convert the operand to a floating-point number, for example: 5.0/9.0.
- The string is stored as a character array. Example: Char strings[20].
- GetChar, sanf, are read data from the input buffer. If the buffer has data remaining, calling these functions again does not wait for the user to input, but instead takes the data directly from the buffer.
- scanf ("%c%c", &var1,&var2), the first string is entered after the input of an invisible character (tab, space, carriage return) can be entered as the first string of flags.
- Determines whether the input character is a number, for example, C is the character entered by the keyboard
' 0 ' ' 9 '//compare numbers with single quotes to character type
Because C saves the ASCII code of the input character, the value of 0~9 in the ASCII code is not 0~9, but 48~57. Therefore, the value of the comparison also needs to be converted into a character type. This can be one by one on the corresponding.
- The starting position of program execution for C language starts with the main function.
The main function itself is also a function, so it can also return a value to its callers.
The caller of the main function is actually the execution environment of the program.
A return value of 0 indicates that the program terminated normally, and not 0, indicating an exception condition or an error end.
- Function prototypes
Tells the compiler what parameters a function will accept, what return value will be returned, and the > Sample compiler will be able to check that the call to the function is correct and that there is an incorrect type conversion. For example, the following function prototypes;
int some_func (int,char•,long);
The compiler checks that all references to the function, including the function's definition, use three parameters > and returns a value of type int. If the compiler discovers that a function's call or definition does not match the function prototype, the compiler reports an error or warning message
- function parameters
The function parameter is passed by value. Parameters can be thought of as function internal variables that are easy to initialize.
If the parameter needs to be passed by reference, the pointer needs to be passed to the argument, and the argument must be declared as a pointer type.
When a parameter is an array, the value passed to the function is the position or address of the starting element of the array-it does not copy the array element itself.
Introduction to Chapter I.