Pointer C language, occupies an important position. Before the final int, char, double, other categories appear. It is a kind of data type, its special reason is int and other basic type variable store content, the PIN variable holds the address.
Memory is divided into a number of hope zones, where the cell number is the address and the pointer is defined as:
Data type * variable name.
Eg:int *pnum;
Of * Indicates that pnum is a pointer-type variable. int is the type of a pointer variable, which means it can only point to an int variable.
The pointer also has an operator of "&" named: Fetch address character. Hence the name of righteousness. Take the address, take the address where the variable is located.
such as: int a = 0. PN;
PN = &a;
It is now possible to manipulate variable a indirectly through the pointer pn.
So how can we manipulate the value of a? You need to use the value of the "*", where the * is different from the above * meaning, the above * indicates that this is a pointer variable, and here * represents the value of the variable that the pointer variable refers to.
such as: int A, b = 1,*pn;
PN = b;
A = *PN;
At this point A has a value of 1.
Pointers are also capable of self-increment or self-subtraction operations. Because the pointer holds the "Unit number" (address), when the pointer is added 1, it points to the next "unit number".
such as: int *pn;
int a[3] = {n/a};
PN = A;
pn++;
When array A is assigned directly to PN. The PN points to the address of the array's first address, which is a[0]. When pn++, PN points to the address of the next address, also known as a[1], and is self-reducing.
It's important to note that. When the pointer is to the last element of the array, since that is the case, then when the operation is added, the array is out of bounds. Because the address pointed to unknown, what happened in the end is unknown.
Small words c pointer