In the past, I always couldn't understand the knowledge in the chapter of pointer , Learning is very confusing , That's not true , The exam is coming soon , It's got to be full fire , Today at CSDN Blog see a summary of knowledge about pointer , I think it has benefited a lot , I feel a lot !

<> Pointer

Definition of pointer :
A pointer is a variable , The variable used to hold the address

The type of pointer :

(1) Basic types :int ,short,long,float ,double,char
as int *p;// Represents the definition of a pointer , This pointer points to the integer variable , This pointer will hold the address of the integer variable .

**(2) Array pointer :** Pointer to an array
int (*a)[10];// Indicates that the pointer points to a int The length of the type is 10 Array of

**(3) Function pointer :** Pointer to a function
void (*a)();// Indicates that the pointer points to a function that has no parameters and no return value

A reference to a pointer : After the pointer reference, the value of the variable corresponding to the address is obtained .

Secondary pointer : Pointer to the first level pointer address

Operation of pointer :
(1) Pointer + perhaps - a number , Represents an integer multiple of the memory occupied by the type of the pointer plus or minus this number
as int *p=a;
p=p+2; // stay VC6.0 inside , actually p Yes 2 * 4=8

(2) Pointer minus a pointer , Represents the number of memory units or elements that differ between two pointers , It doesn't make sense to add two pointers

(3) Relational operation , If two pointer variables are defined p and q, And it's all initialized ,
If p==q, Then it means p and q Point to the same address
p>q, Then it means p Point to high address and q Point to low address
And often p and NULL Make a comparison , Used to indicate the current state of a pointer , This is widely used in data structure , It's better to look up the linked list and so on

Relationship between pointer and array :
Pointers are closely related to arrays , Arrays can be referenced by pointers , Arrays can hold pointers , Arrays can also be accessed by pointers , A pointer can also hold the address of an array

©2020 ioDraw All rights reserved
Java exercises 1: Simply define a car class New photo album app launched by Microsoft : Using cross platform framework React Native to write Chapter two Fundamentals of programming Programming exercises pandas Time order of webpack Code segmentation import()Vue slot slot: Default slot , Named slot , Scope slot Fundamentals of data analysis ——R language ( Processing missing values )C++ Implementation of matrix meteor shower effect PostMan Advanced Usage , Interface MD5+Secret autograph Sign The 12th Blue Bridge Cup B group C/C++ Provincial competition