1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| #define _CRT_SECURE_NO_WARNINGS 1 #include<stdio.h>
struct Stu { char name[20]; int age; char sex[5]; char id[15]; };
int main() { struct Stu s = { "张三",18,"男","20241574" }; printf("名字:%s 年龄:%d 性别:%s 学号:%s\n", s.name, s.age, s.sex, s.id);
struct Stu* ps = &s; printf("名字:%s 年龄:%d 性别:%s 学号:%s\n", ps->name, ps->age, ps->sex, ps->id); return 0; }
|