使用结构体指针变量实现显示
程序运行结果如下:
代码如下:
#include<stdio.h>
struct student{
int num;
char name[1024];
char sex;
int age;
float score;
};
int main() {
struct student student1 = { 001, "zhangsan", 'M', 25, 95.66 };
struct student *p;
p = &student1;
printf("%d\n", p->num);
printf("%s\n", p->name);
printf("%c\n", p->sex);
printf("%d\n", p->age);
printf("%f\n", p->score);
system("pause");
return 0;
}