码迷,mamicode.com
首页 > 其他好文 > 详细

pointer p, addr of pointer p, value of *p

时间:2015-06-16 09:14:45      阅读:127      评论:0      收藏:0      [点我收藏+]

标签:

void pointer(int *p)
{
  int a = 11;
  printf("\nthe p is %p , addr is %p, *p is %d",p , &p, *p);
  *p =11;
  printf("\nthe p is %p , addr is %p, *p is %d",p , &p, *p);
  p = &a;
  printf("\nthe p is %p , addr is %p, *p is %d",p , &p, *p);
}

int main()
{
 int b =22;
 int *p = &b;

 printf("the p is %p , addr is %p, *p is %d",p , &p, *p);
 pointer(p);
 printf("\nthe p is %p , addr is %p, *p is %d\n",p , &p, *p);
}

运行结果:

the p is 00A0FEE4 , addr is 00A0FEDC, *p is 22
the p is 00A0FEE4 , addr is 00A0FEE0, *p is 22
the p is 00A0FEE4 , addr is 00A0FEE0, *p is 11
the p is 00A0FEE8 , addr is 00A0FEE0, *p is 11
the p is 00A0FEE4 , addr is 00A0FEDC, *p is 11

pointer p, addr of pointer p, value of *p

标签:

原文地址:http://www.cnblogs.com/FEMONT/p/4579869.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!