/*多级指针*/
#include <stdio.h>
int main(int argc, char const *argv[])
{
int a=1;
int *p=&a;
int **p2=&p;//2级指针指向指针变量p的地址。
//char **p2=(char **)&p;
printf("%d\n",*p );
printf("%d\n",*p2 );
printf("%d\n",**p2 );
/*const char *pday[] = {"Mon","Tue","Wed","Thu","Fri","Sat","Sun"};
const char **ppday;
int i;
for(i = 0;i < 7;i++)
{
ppday = pday + i;
printf("ppday = %s\n",*ppday);
}*/
return 0;
}
/*字符数组+数组指针*/
#include <stdio.h>
int main(int argc, char const *argv[])
{
int buf[2]={1,2};
int *p=buf;
printf("%d,%d\n",*p,*(p+1) );
int (*ptr)[2];
ptr=&buf;
printf("%d,%d\n",*ptr[0],*(ptr[0]+1) );
printf("%d,%d\n",(*ptr)[0],(*ptr)[1] );
return 0;
}