int* p; p is an integer pointer variable
int* p[n]; p is a pointer array by the amount of n-pointer pointing to an integer elements
int* p(); p points to a function which return an integer pointer
int (*p)(); p is a function pointer, points to a function which return an integer value
int** p; p is an pointer variable points to another pointer, this pointer point to an integer
(1)get address:
use "&" get the address of the variable
(2)get value:use "*" get the target of the pointer
(3)assign operate:·assign variable address to an pointer
int i;
int* p = &i;
·between the same type pointer variable assignment
int* p = &i;
int * q = p;
·address of the first element in the array assign to pointer
int a[3]={10,20,30};
int* p = a;
·assigned to the function entry address of a pointer variable
typedef int (*funcptr)();
funcptr p;
extern int foo();
p = &foo;
·array pointer
int a[5]={10,20,30,40,50};
int* p = a;
p+=3; p-=3; p++; P--;
·subtract a pointer from a pointer of the same type,
get the difference in the subscripts of the two elements. So, the resulting type isn't a pointer but is a signed integer type.
·The two pointers point to the same array of variables can be greater than, less than, equal to the comparison operator.
·Compared with Zero,p==0 means point to NULL。
This comment has been removed by the author.
ReplyDelete