Common standard libraries:
Assert. h: assert macro. Can perform self-check
Ctype. h: character processing, character classification, and size conversion
Errno. h: handle error messages
Float. h: Floating Point
Limits. h: the integer size, which provides a macro that describes the integer type.
Lcale. h: localization
Math. h: mathematical functions
Setjmp. h: Jump
Signal. h: Signal Processing
Stdarg. h: Variable Length Parameter Processing
Stddef. h: Definition of frequently used types
Stdio. h: Input and Output
String. h: string processing
Stdlib. h: other functions, strings, numbers, random numbers, memory management, system communication, search sorting, etc.
Time. h: processing time and date
Stdbool. h: boolean type and value
Conversion between pointer and value:
Void (P = NULL;
Int num = 8;
P = & num;
Int A = * (int *) P );
In the computer, the address of the first character of the string is used to represent the entire string (char *).
Multiple identical strings are the same (Address) at runtime ).
Multiple strings can be written together directly without strcat connection, for example, char * pstr = "123" "456 ";
Only character arrays containing '\ 0' can be used as strings.
Char STR [] = "ABCDE"; // contains 6 characters, the last character is '\ 0', And the ascll code is 0.
String function: strlen/strcat/strcmp/strncmp/strcpy/strncpy
Input string processing to automatically remove unnecessary input:
Char s [50] = {0 };
Fgets (s, 50, stdin );
If (strlen (S) = 49 & S [48]! = '\ N' & S [49] =' \ 0 ')
{
Scanf ("% * [^ \ n]"); scanf ("% * C ");
}
Fgets (): The length is (string digits-1). The character is: (when there are few characters) content + "\ n \ 0" Or: (when there are many characters) content + "\ 0 ".
Pointer operation string:
Char * STR [50] = "10 \ 020 \ 030 \ 040 \ 050 \ 0 ";
Char * pstr [5] = {0 };
Pstr [0] = STR;
Pstr [1] = STR + 3;
Pstr [2] = STR + 6;
Pstr [3] = STR + 9;
Pstr [4] = STR + 12;
Char c = * (pstr [0]); // The value of C is '1'
Printf ("% s", pstr [0]); // output: 10