指针-->(纯指针)

 1 #include <iostream>
 2 #include <stdio.h>
 3 #include <stdlib.h>
 4 #include <string.h>
 5 
 6 using namespace std;
 7 
 8 int main(){
 9     char p[20]="you are a student!";
10     int *a = (int *)p;
11     int **b = &a;
12     char *c;
13     c = p;
14     cout<<"*b->  "<<b<<endl;
15     cout<<"&a->  "<<&a<<endl;
16 
17     cout<<"a->   "<<a<<endl;
18     cout<<"p->   "<<&p<<endl;
19 
20     cout<<"**b-> "<<**b<<endl;
21     printf("%c\n",**b);
22     cout<<"*a->  "<<*a<<endl;
23     printf("%c\n",*a);
24 
25     cout<<"*b->  "<<*b<<endl;
26     cout<<"a->   "<<a<<endl;  
27 
28     c++;
29     cout<<"c->:" <<c<<endl;
30     printf("%x\n",c);
31     cout<<"p->:" <<&p[1]<<endl;
32     printf("%x\n",&p[1]);
33 
34 }

posted on 2012-11-02 10:49  凌峰布衣  阅读(213)  评论(0编辑  收藏  举报

导航