fork download
  1. #include<string.h>
  2. #include<stdio.h>
  3. struct student
  4. { int num;
  5. char name[20];
  6. char sex;
  7. int age;
  8. };
  9. void outputstu(struct student stu[3]);
  10. int main(void){
  11. struct student stu[3]={{10101,"Li Lin",'M',18},{10102,"Zhang Fun",'M',19},
  12. {10104,"Wang Min",'F',20}};
  13. return 0;
  14. }
  15. void outputstu(struct student stu[3])
  16. {
  17. struct student *p;
  18. printf("No. name sex age\n");
  19. for(p=stu;p<stu+3;p++)
  20. printf("%5d %-20s %2c %4d\n",(*p).num,(*p).name,p->sex,p->age);
  21. }
Success #stdin #stdout 0s 4312KB
stdin
Standard input is empty
stdout
Standard output is empty