Directory:
1, simple use of pointers
2. Complex pointer usage
3. Some special pointer types
4. Summary
First, simple use of pointers
#include <iostream>using namespace std;int main () { //null 0x0 is actually the same, are empty pointers int * ip1, *ip2=null; cout << ip2 << endl; //define pointers, in fact, the following is useless double dp, *dp2; int ival = 42; int *p = &ival; // p points to ival address value cout << p << endl; ip1 = p; // as with the P variable, the pointer to the address value is assigned to the ip1 cout << ip1 << endl; cout << *p << endl; cout << ival << endl; cout << *ip1 << endl;}
From the above example, you should understand that the pointer is probably a kind of reference data type, and Java almost, Java is all object, reference to objects. The purpose is to implement an indirect access to other types, objects, and attributes.
II. Complex pointer usage
1. accessing struct fields by pointer
2.
Iii. Some special types of pointers
Iv. Summary
-------------Smoke a cigarette and go to sleep. I have to go to work tomorrow-----write it tomorrow-------
C + + pointers