P504 指针和结构体
#include<cstdio>
struct person {
char *name;
int age;
};
int main(){
struct person first;
struct person *ptr;
first.age=21;
first.name="Zhang San";
ptr=&first;
printf("%d\n",first.age);
printf("%d\n",(*ptr).age);
printf("%d\n",ptr->age);
return 0;
}

浙公网安备 33010602011771号