博主: 这个娃说的挺对胃口的,转了
1:转自:http://www.360doc.com/content/11/0925/16/6527018_151129737.shtml
很多人把指针说的洪水猛兽似的,其实就那么回事儿嘛
2:字符指针与整形指针的一点儿分析
【C|关于指针的一点儿小知识】转自:http://blog.csdn.net/ghost1236/article/details/6309809
不错滴。
#include
#include
/*int main(void)
{
int *pi;
char * pc;
long * pl;
char a[]="abcdefg";
int b = 10000;
printf("the sizeof int* is %d \n",sizeof(pi));
printf("the sizeof char * is %d \n",sizeof(pc));
printf("the sizeof long * is %d \n",sizeof(pl));
pi = a;
printf("array: the sizeof intis %s \n",pi);
pc = a;
printf("array:the sizeof charis %s \n",pc);
pl = a;
printf("array:the sizeof longis %s \n",pl);
*pi = b;
printf("char number: the sizeof int is %d \n",*pi);
*pc = b;
printf("char number: the sizeof char is %d \n",*pi);
*pl = b;
printf("char number: the sizeof long is %d \n",*pi);
return 0;
}*/
/*int main(int argc, char *argv[])
{
char day[15] = "abcdefghijklmn";
char* strTmp = "opqrstuvwxyz";
printf("&day is %x\n",&day);
printf("&day[0] is %x\n",&day[0]);
printf("day is %x\n",day);
printf("\n&strTmp is %x\n",&strTmp);
printf("&strTmp[0] is %x\n",&strTmp[0]);
printf("strTmp is %x\n",strTmp);
getchar();
return 0;
}*/
int main(int argc, char *argv[])
{
char *c = "123456";
int*i = "123456";
printf("&c is %d\n",&c);
printf("c is %x\n",c);
printf("*c is %s\n",c);
c++;
printf("c++\n&c is %d\n",&c);
printf("c is %x\n",c);
printf("*c is %s\n",c);
*c++;
printf("*c++\n&c is %d\n",&c);
printf("c is %x\n",c);
printf("*c is %s\n",c);
printf("\n\n\n&i is %d\n",&i);
printf("i is %x\n",i);
printf("*i is %s\n",i);
i++;
printf("2222 i++\n&i is %d\n",&i);
printf("i is %x\n",i);
printf("*i is %s\n",i);
printf("3333*i++\n&i is %d\n",&i);
printf("i is %x\n",i);
printf("*i is %s \n",i);
return 0;
}
推荐阅读
- Boost|C++ 结合 Boost(40行代码读写和处理 txt 文件)
- C/C++|容器(list用法及示例)
- C/C++|容器(forward_list用法及示例)
- c/c++|有感 Visual Studio 2015 RTM 简介 - 八年后回归 Dot Net,终于迎来了 Mvc 时代,盼走了 Web 窗体时代...
- C/C++|C/C++ basis 02
- Qt实战|Qt+OpenCV联合开发(二十一)--图像翻转与旋转
- Qt实战|Qt+OpenCV联合开发(十四)--图像感兴趣区域(ROI)的提取
- Qt实战|Qt+OpenCV联合开发(十三)--通道分离与合并
- opencv|Qt+OpenCV联合开发(十六)--图像几何形状绘制