最近在学习数据结构,巩固下c语言。
#include<stdio.h> /*定义结构体student并设置别名stud*/ /*typedef struct student{ int num; char *name; int score; }stud; */ /*同上面4行代码*/ struct student{ int num; char *name; int score; }; typedef struct student stud; stud stu[3] = { {1026,"Jack",100}, {1028,"Michael",80}, {1030,"Nice",30} }; int main() { int i; for(i=0;i<3;i++) { printf("%d,Name:%s,score:%d\n",stu[i].num,stu[i].name,stu[i].score); } return 0; }
原文:http://www.cnblogs.com/moyan01/p/5554568.html