Catherine_zhilin

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理
1 #include <stdio.h>
2 
3 /*在变量前面加上&就可以表示变量的地址*/
4 int main(){
5     int a=1;
6     printf("%d,%d\n",&a,a);
7     return 0;
8 } 
在变量前面加上&就可以表示变量的地址

指针变量

int* p;

double* p;

char* p;

int* p1,p2;    //p1是int*型的,p2是int 型的。

-------------------

int a;

int *p=&a;

int a;

int *p;

p=&a;

---------------

int a,b;

int *p1=&a,*p2=&b;

--------------------------

 1 #include <stdio.h>
 2 
 3 int main() {
 4     int a;
 5     int *p=&a;
 6     a=233;
 7     printf("%d\n",p);//p是地址 
 8     printf("%d\n",*p);//*p是a存入的值 
 9     return 0;
10 }
P是地址*p是地址中的元素

 

posted on 2019-07-05 09:09  kkkshiki  阅读(139)  评论(0编辑  收藏  举报