摘要: 通过指针遍历数组的小把戏 #include<stdio.h> #include<stdlib.h> #include<Windows.h> void main() { int a[10] = {1,2,3,4,5,6,7,8,9,10}; for (int *p = a; p <= a + 9; p 阅读全文
posted @ 2019-11-28 20:21 saintdingtheGreat 阅读(127) 评论(0) 推荐(0) 编辑
摘要: 指针的运算在数组中才有意义 int *p; p++,一定是在一片连续的区域才有意义,当然越界也会带来诸多问题。 void main() { int num = 10; int *p = &num;//这根本无界可言 p++; printf("%d\n",*p); getchar(); } 输出结果: 阅读全文
posted @ 2019-11-28 15:59 saintdingtheGreat 阅读(233) 评论(0) 推荐(0) 编辑