|
Post by huangno1 on Mar 2, 2017 20:20:25 GMT -8
#include <stdio.h>
int main()
{
int a = 10, b = 20;
int *p ;
p = &a ; // let p point to a
printf("%d\n", *p); // 10
* p = 30;
printf("%d\n", a); // 30
int *q = &b ;
// define q and initialize q by b's address
printf("%d\n", *q); // 20
q = p;
printf("%d %d\n", b, *q); // 20 30
q = &b;
*q = *p;
printf("%d %d\n", a, b); // 30 30
return 0;
}
|
|