fork download
  1. #include <stdio.h>
  2.  
  3. struct date
  4. {
  5. int month;
  6. int day;
  7. int year;
  8.  
  9. };
  10.  
  11. void printNextDay (struct date dateval); //function prototype
  12.  
  13. int main ()
  14. {
  15. struct date today; //local variable to main
  16.  
  17. //set up a date to pass to the printNextDay function
  18. today.day = 17;
  19. today.year = 1996;
  20. today.month = 10;
  21.  
  22. //pass by value the info to our function
  23. printNextDay (today);
  24.  
  25. printf ("%d/%d/%d \n", today.month, today.day, today.year-1900);
  26.  
  27. return (0);
  28. } //main
  29.  
  30. //******************************************************************
  31. // Function: printNextDay
  32. //
  33. // Description: Simply prints the next day of a given 20th century date
  34. // in MM/DD/YYYY format. Does not check for last day in the month (known
  35. // issue to be addressed in the future)
  36. //
  37. // Parameters: dateval - a structure with month, day, and year
  38. //
  39. // Returns: void
  40. //
  41. //******************************************************************
  42.  
  43. void printNextDay (struct date dateval)
  44. {
  45. ++dateval.day; //add a day to the value passed into this function
  46. printf ("%d/%d/%d \n", dateval.month, dateval.day, dateval.year-1900);
  47.  
  48. return; //optional, no value returned sincxe it returns void
  49.  
  50. } //printNextDay
Success #stdin #stdout 0.01s 5320KB
stdin
Standard input is empty
stdout
10/18/96 
10/17/96