Multi-level pointers:
int main () {int i=10;int *p=&i;int **pp=&p;int ***ppp=&pp;cout<<p<< ":" <<*p<< ":" <<endl; COUT<<PP << ":" <<*pp<< ":" <<**pp<< ":" <<endl;cout<<ppp<< ":" <<*ppp<< ":" <<**ppp << ":" <<***ppp<< ":" <<endl;return 0;}
Array pointers
void Main () {int a[3][3]={1,2,3,4,5,6,7,8,9}; int (*q) [3];//array pointer q=a;cout<<q<<endl;//0012ff24cout< <*q<<endl;//0012ff24cout<<*q+1<<endl;//0012ff28//p+4bitcout<< *q[0]<<endl;// 1cout<< **q <<endl;//1 equals cout<<**q+100<<endl;//101cout<<** (q+1) <<endl;/ /4cout<<* (*q+1) <<endl;//2cout<<q+1<<endl;//0012ff30cout<<* (q+1) <<endl;// 0012ff30cout<<q+3<<endl;//0012ff48,cout<<*q+1<<endl;}
Array of pointers
void Main () {int a[3][3]={1,2,3,4,5,6,7,8,9}; int *q[3];//pointer array for (int i=0;i<3;i++) q[i]=a[i]; cout<<q <<endl;//ff18 Q itself cout<<*q<<endl;//ff24 a[0][0] address cout<<*q+1<<endl;//ff28 A [0] [1] cout<<* (q+1) <<endl;//ff30 a[1][0] cout<<**q<<endl;//1 a[0][0] Value cout<<* (*q+1) <<ENDL;//2 a[0][1] Value of cout<<** (q+1) <<ENDL;//4 A[1][0]}
#include <stdio.h> #include <iostream>using namespace std; Char *c[]={"ENTER", "NEW", "point", "first"};char **cp[]={c+3,c+2,c+1,c};char ***cpp=cp;int Main (void) {printf ("%s ", **++cpp);//point ++cpp printf ("%s " , *--*++cpp+3);//ER printf ("%s ", *cpp[-2]+3); /stprintf ("%s\n", cpp[-1][-1]+1);//ewreturn 0;}
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
C Language Pointers and arrays