第七章结构体、共用体和枚举类型数据余.pptVIP

  • 2
  • 0
  • 约1.3万字
  • 约 80页
  • 2018-04-13 发布于河南
  • 举报

第七章结构体、共用体和枚举类型数据余.ppt

第七章结构体、共用体和枚举类型数据余

#include “stdio.h” #include “alloc.h” struct student { char name[20]; int age; struct student *next; }; struct student *head,*new,*this; main() { void new_one(void); void out_put(void); char c; int flag=1; new=(struct student*)malloc(sizeof(struct student)); gets(new-name); scanf(“%d”,new-age);getchar(); new-next=NULL; head=new; while(flag) { printf(“New student to add in?(Y/N)”); c=getchar();getchar(); if(c==’y’||c==’Y’) new_one(); else {out_put();flag=0;} } } void new_one(void) { new=(struct student*)malloc(sizeof(struct student)); ge

文档评论(0)

1亿VIP精品文档

相关文档