#include <stdio.h> /** * 声明主函数 * @author xiaqiuchu * @version 0.0.1 * @date 2020/09/27 * * */ int main() { // 结构体声明 struct User { char name[5]; unsigned int age; char desc[255]; /* 设置对应结构变量 */ } student,student1,student2; // 另一种初始化结构变量方法 // struct User student; printf("请输入您的名字:"); scanf("%s", student.name); printf("请输入您的年龄:"); scanf("%d", &student.age); printf("请输入您的介绍:"); scanf("%s", student.desc); printf("您是:%s,您的年龄:%d,您的介绍:%s ", student.name, student.age, student.desc); }