感到结构体对于解决空间多个类型的复杂问题十分巧妙;
#include<stdio.h> struct stu { int num; char name[20]; int score; }; int main() { struct stu s={1001,"zhang",19},*p; p=&s; printf("num\tname\tscore\n"); printf("%d\t%s\t%d\n",s.num,s.name,s.score); printf("%d\t%s\t%d\n",(*p).num,(*p).name,(*p).score); }
时间: 2024-11-10 23:02:24