#include <stdio.h>

struct Student {
    int id;
    char gender;
    char name[20];
    char address[50];
};

int main() {
    struct Student student = {12345, 'M', "张三", "北京市海淀区"};
    printf("学号:%d\n", student.id);
    printf("性别:%c\n", student.gender);
    printf("姓名:%s\n", student.name);
    printf("住址:%s\n", student.address);
    return 0;
}
把一个学生的信息 包括学号、性别、姓名、住址放在一个结构体变量中然后输出这个学生的信息。

原文地址: https://www.cveoy.top/t/topic/eGeB 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录