fork download
  1. #include <stdio.h>
  2. struct STUDENT
  3. {
  4. char name[20];
  5. int ten1;
  6. int ten2;
  7. int ten3;
  8. int tenf;
  9. };
  10.  
  11. void tensyori(struct STUDENT *x);
  12. int main(void)
  13. {
  14. struct STUDENT a = {"sanaka", 70, 65, 80, 0};
  15. tensyori(&a);
  16. printf("氏名=%s 得点=%d", a.name, a.tenf);
  17. }
  18.  
  19. void tensyori(struct STUDENT *x)
  20. {
  21. x->tenf = x->ten1;
  22. if (x->ten2 > x->ten1)x->tenf = x->ten2;
  23. if (x->ten3 > x->ten1)x->tenf = x->ten3;
  24. }
  25.  
Runtime error #stdin #stdout 0s 1832KB
stdin
Standard input is empty
stdout
氏名=sanaka  得点=80