#include<stdio.h>
int main()
{
int a;
int *p;
a = 10;
p = &a;
printf("%d\n",p);
printf("%d\n",*p);
printf("%d\n",&a);
}
6487572 10 6487572
#include<stdio.h>
int main()
{
int a;
int *p;
a = 10;
p = &a;
printf("%d\n",a);
*p = 12;
printf("%d\n",a);
}
10 12
#include<stdio.h>
int main()
{
int a;
int *p;
a = 10;
p = &a;
printf("%d\n",p);
printf("%d\n",*p);
int b = 20;
*p = b;
printf("%d\n",p);
printf("%d\n",*p);
}
6487568 10 6487568 20
#include<stdio.h>
int main()
{
int a;
int *p;
a = 10;
p = &a;
printf("%d\n",p);
printf("%d\n",sizeof(int));
printf("%d\n",p+1);
printf("%d\n",*p);
}
6487572 4 6487576 10
#include<stdio.h>
int main()
{
int a = 1025;
int *p;
p = &a;
printf("%d\n",sizeof(int));
printf("%d\n%d\n",p,*p);
char *p0;
p0 = (char*)p;
printf("%d\n",sizeof(char));
printf("%d\n%d\n",p0,*p0);
printf("%d\n%d\n",p0+1,*(p0+1));
}
4 6487564 1025 1 6487564 1 6487565 4
#include<stdio.h>
int main()
{
int x = 5;
int *p = &x;
*p = 6;
int **q = &p;
int ***r = &q;
printf("%d\n",*p);
printf("%d\n",*q);
printf("%d\n",*(*q));
printf("%d\n",*(*r));
printf("%d\n",*(*(*r)));
***r = 10;
printf("%d\n",x);
**q = *p + 2;
printf("%d\n",x);
}
6 6487572 6 6487572 6 10 12
|