温习C语言(1):指针与地址
#include<stdio.h> #include<stddef.h> int main(int argc,char **argv) { char c; char *p = &c; printf("len of char is %d\n",sizeof *p); int x = 1, y = 2, z[10]={8,22,33}; int *ip = &x; printf("x,y is %d,%d\n",x,y); y= *ip; printf("x,y is %d,%d\n",x,y); *ip = 0; printf("x,y is %d,%d\n",x,y); ip = z; x = *ip; printf("x,y is %d,%d\n",x,y); *ip = *ip + 10; y = *ip + 1; printf("x,y,*ip is %d,%d,%d\n",x,y,*ip); //8,19,18 ++*ip; x = *ip; printf("x,y,*ip is %d,%d,%d\n",x,y,*ip); //19,19,19 (*ip)++; printf("x,y,*ip is %d,%d,%d\n",x,y,*ip); //19,19,20 *ip++; printf("x,y,*ip is %d,%d,%d\n",x,y,*ip); //19,19,22 return 0; }
作者:代码示例
出处:http://codemo.cnblogs.com/
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
您的支持是我前进的动力,请猛击: