fork download
  1. #include <stdio.h>
  2.  
  3. struct day{
  4. int month;
  5. int day;
  6. }today = { 5,30 };
  7.  
  8. struct person{
  9. char name[99];
  10. int age;
  11. struct day birthday;
  12. };
  13.  
  14. void func(struct person His);
  15. void printdata(const struct person His);
  16.  
  17. int main(void){
  18. struct person ui = {"ui", 16,{ 5, 30}};
  19.  
  20. func(ui);
  21. func(ui);
  22.  
  23. printdata(ui);
  24.  
  25. return 0;
  26. }
  27.  
  28. void func(struct person His){
  29. if(His.birthday.month==today.month && His.birthday.day==today.day)
  30. His.age++;
  31. today.day++;
  32. }
  33. void printdata(struct person His){
  34. printf("今日は%d月%d日です\n", today.month , today.day );
  35. printf("%sさんは%dさいです\n",His.name,His.age);
  36. }
Success #stdin #stdout 0s 5284KB
stdin
Standard input is empty
stdout
今日は5月32日です
uiさんは16さいです