fork download
  1. struct time
  2. {
  3. int hour, minutes, seconds;
  4. };
  5.  
  6. struct date
  7. {
  8. int month, day, year;
  9. };
  10.  
  11. struct date_and_time
  12. {
  13. struct date sdate;
  14. struct time stime;
  15. };
  16.  
  17. #include <stdio.h>
  18. int main ()
  19. {
  20.  
  21. struct date_and_time event =
  22. {
  23. {12,31,1999}, /* date - month, day, year*/
  24. {11,59,58} /* time - hour, minutes, and seconds*/
  25. };
  26.  
  27. event.sdate.month = 12;
  28.  
  29. ++event.stime.seconds;
  30.  
  31. printf ("\nDate:\t %i/%i/%i\n",
  32. event.sdate.month,
  33. event.sdate.day,
  34. event.sdate.year);
  35.  
  36. printf ("Time:\t %i hour(s) %i minute(s) %i second(s)\n",
  37. event.stime.hour,
  38. event.stime.minutes,
  39. event.stime.seconds);
  40.  
  41. return (0);
  42.  
  43. } /* main */
  44.  
Success #stdin #stdout 0.01s 5276KB
stdin
Standard input is empty
stdout
Date:	 12/31/1999
Time:	 11 hour(s) 59 minute(s) 59 second(s)