c语言笔记(国外英文资料)
c语言笔记(国外英文资料)
Getchar ();
Gets (name []); / / getchar is used to clear the unused characters of the last data entry (including the \ n return space);
The pointer points to the difference between an integer array and a character array:
Char a [5], [10]; P is equal to a [0]. Char a, [5]. P = & a [0];
Int a [5] [5]; P is equal to a [0]. Int a, [5]. P = a;
The pointer points to the difference between an int two-dimensional array and a char two-dimensional array:
Int a [5]. P is equal to a [0]. When used, the whole range is * p ~ * (p + 24). 25 (integer)
Char a [5], [5]; P = a; When used, the entire array range is p ~ p + 4; (5 strings, p: char (* p) [6] an array pointer)
Pointer array and one-dimensional array pointer: char STR [5]. P = STR. (pointer to a one-dimensional array)
Char STR [5]. P [I] = STR [I] (pointer array, I = 0 ~ 4)
Emphasis: the two-dimensional array name is pointing to the row, and 1 in a + 1 represents the number of bytes in a row of all elements.
An array name points to the column, a [0];
Char STR [5], [10]; Char (* p) [10]; P = STR. When making a function call, the function declaration section cannot be omitted from [10], such as: void hs (char * [10])
Char sta [20]. P = STR. Gets (p); , gets (STR); Can be fixed.
Summary of Pointers:
The pointer is the address, where the "pointer" can be used instead of the "address", and the pointer to the variable is the address of the variable
Distinguish pointer and pointer variables:
Pointer: a pointer is an address, such as the address of a variable in 2008, which is a pointer to a variable
Pointer variable: the value of a pointer variable is an address
Pointing: the address means pointing to a specific object through the address
For pointer variables, you put the address in a variable, and this pointer points to whom
Data objects in memory is allocated space, also have the address, also has a pointer, you can define some pointer variable to store the address of the data object
Void * is a special pointer t