要求:同规格指向结构体指针变量实现在窗口上显示学生的信息
运行结果如下
完整代码如下
#include <stdio.h>
struct student
{
int num;
char name[20];
char sex;
int age;
float score;
};
int main()
{
struct student student1 =
{
1001, "李XX", 'M', 25, 90.3
};
struct student *p;
p = &student1;
printf("Number:%d\n", p->num);
printf("Name:%s\n", p->name);
printf("Sex:%c\n", p->sex);
printf("Age:%d\n", p->age);
printf("Score:%5.1f\n", p->score);
return 0;
}