测试代码
#include <stdio.h>
int a =112,b =-1;
float c= 3.14;
int *h = &a;
float *e = &c;
int x = 12;
int *y = &x;
int **z = &y;
char ch = 'a';
char *cp = &ch;
main(){
int *w = malloc(sizeof(int));
memset(w, 0, sizeof(int));
int u =4;
memcpy(w, &u, sizeof(int));
printf("%d\n",*w);
free(w);
printf("%s\n","-------------------");
printf("%ld\n",&a);
printf("%d\n",*h);
printf("%d\n",h);
printf("%d\n",e);
printf("%s\n","-------------------");
printf("%d\n",(int)*(&x));
printf("%d\n",(int)*(y));
printf("%d\n",(int)*(*z));
printf("%s\n","-------------------");
printf("%c\n",(char)*(cp));
printf("%c\n",(char)++*(cp));
printf("%c\n",(char)*(cp)++);
printf("%s\n","-------------------");
}
打印出来的值
4
-------------------
134520872
112
134520872
134520880
-------------------
12
12
12
-------------------
a
b
b
-------------------