(转http://www.nowamagic.net/librarys/veda/detail/2128)
int i; int *pi; i = 30; pi = &i; printf("%d\n", i); printf("%d\n", *pi); printf("%d\n", &i);
#include "stdio.h" main() { char a,*pa; a = 10; pa = &a; *pa = 20; printf("%d", a); }
输出:20
int i, *pa, a[] = {3,4,5,6,7,3,7,4,4,6}; pa = a; /*请注意数组名a直接赋值给指针pa*(a的首地址赋给pa)/ for (i = 0; i <= 9; i++) { printf("%d\n", pa[i]); }
或
int i, *pa, a[] = {3,4,5,6,7,3,7,4,4,6}; pa = a; for (i = 0; i <= 9; i++) { printf("%d\n", *(pa+i)); }
原文:http://www.cnblogs.com/onwayo/p/3536560.html