最近在學習數據結構,鞏固下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; }