title: return multiple output from option 1 , how to store it at main function and use it for option 3
body: <p>How can I store the result of getYearOfBirth ,option 1 and 2 to main function and use it for option 3 where to print those result as receipt.</p>
  
  <p>What problem i have found is:</p>
  
  <p>1) if I put , for example : </p>
  
  <pre><code>int y;
  y=getYearOfBirth
  </code></pre>
  
  <p>when I run until the function where user can re-enter the yearOfBirth , it will print the 1st input instead of re-enter input</p>
  
  <p>2) in option 1 , I have many value to return , totalSum, quantity1,quantity2,quantity3,quantity4, i dont know how to return it to main function</p>
  
  <p>This is my code:</p>
  
  <h1>edited ,added y=getYearOfBirth()</h1>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;math.h&gt;
  void printWelcome(void); //print welcome
  int getYearOfBirth (void); // prompt user to enter a year of birth , below 1900 show no valid
  int confirmYob (void); // check if the year of birth is enter correctly
  void displayMenu (void); //in option1 show table of product,with code and price
  int getTotalSum (void); // when user selected product will calculate sum
  int confirmTotalSum (void); // if the user make mistake can Re-enter the product purchase 
  int parkingCalculator (void); //enter the parking hour and calculate amount that need to pay
  int confirmParkingFee (void); // if the user make mistake can Re-enter the parking hour
  int main ()
  {
  int choice,y;
  printWelcome();
  y = getYearOfBirth();
  confirmYob();
  while(1)
  {
      printf("Select an Action:\n");
      printf("1.Enter product purchased\n");
      printf("2.Enter parking hours\n");
      printf("3.Calculate and print the total bill\n");
      printf("4.Exit\n\n");
      scanf("%d",&amp;choice);
  
      switch(choice)
      {
      case 1:
          {
          displayMenu();
          getTotalSum();
          confirmTotalSum();
          }
          break;
      case 2:
          parkingCalculator();
          confirmParkingFee();
          break;
      case 3:
          {
          printf("Test3\n\n");
          printf("%d\n\n",y)
          break;
          }
      case 4:
          exit(0);
      }
  }
  return 0;
  }
  void printWelcome(void)
  {
  printf("Welcom to :-\n");
  printf("+-----------------------+\n");
  printf("|     BIGSALES MALL     |\n");
  printf("+-----------------------+\n");
  }
  int getYearOfBirth (void)
  {
  int yearOfBirth;
  
  printf("Please enter your year of birth:\n");
  scanf_s("%d", &amp;yearOfBirth);
   while (yearOfBirth &lt;1900)
      {
          printf("Warning! The year you entered is not valid!\n");
          printf("Please Enter Again.\n");
          printf("Please enter your year of birth:\n");
          scanf_s("%d", &amp;yearOfBirth);
      } 
  printf("Your year of birth is: %d\n",yearOfBirth);
  return yearOfBirth;
  }
  int confirmYob (void)
  {
  int confirm1;
  printf("Is it correct? Enter 1 for YES to Continue ,0 for NO and Re-Enter 
  \n");
  scanf("%d",&amp;confirm1);
  while( confirm1 ==0 )
  {
      getYearOfBirth();
      printf("Is it correct? (Enter 1 for YES to Continue ,0 for NO and Re- 
  Enter) \n");
      scanf("%d",&amp;confirm1);
  }
      printf("Year of birth confirmed\n\n\n");
  return 0;
  }
  void displayMenu (void)
  {
  printf("+--------------+--------------------+\n");
      printf("| Product Code | Rentail Price (RM) |\n");
      printf("+--------------+--------------------+\n");
      printf("| 1            | 45.20              |\n");
      printf("+--------------+--------------------+\n");
      printf("| 2            | 14.50              |\n");
      printf("+--------------+--------------------+\n");
      printf("| 3            |  3.45              |\n");
      printf("+--------------+--------------------+\n");
      printf("| 4            |  7.80              |\n");
      printf("+--------------+--------------------+\n");
  }
  int getTotalSum (void)
  {
  int code;
  float sum=0,totalSum,quantity1=0,quantity2=0,quantity3=0,quantity4=0;
  while(1)
  {   
      printf("Enter a product code.(Enter 5 to get total sum)\n");
      scanf("%d",&amp;code);
  
      switch(code)
      {
      case 1:
          {
          quantity1=( quantity1 + 1);
          sum=( 45.20 + sum);
          printf("Current Sum: RM%.2f\n",sum);
          break;
          }
      case 2:
          {
          quantity2=( quantity2 + 1);
          sum=(14.50 + sum);
          printf("Current Sum: RM%.2f\n",sum);
          break;
          }
      case 3:
          {
          quantity3=( quantity3 + 1);
          sum=(3.45 + sum);
          printf("Current Sum: RM%.2f\n",sum);
          break;
          }
      case 4:
          {
          quantity4=( quantity4 + 1);
          sum=(7.80 + sum);
          printf("Current Sum: RM%.2f\n",sum);
          break;
          }
      case 5:
          totalSum= sum;
          printf("+--------------+--------------------+----------+\n");
          printf("| Product Code | Rentail Price (RM) | Quantity |\n");
          printf("+--------------+--------------------+----------+\n");
          printf("| 1            | 45.20              | %.f        |\n",quantity1);
          printf("+--------------+--------------------+----------+\n");
          printf("| 2            | 14.50              | %.f        |\n",quantity2);
          printf("+--------------+--------------------+----------+\n");
          printf("| 3            |  3.45              | %.f        |\n",quantity3);
          printf("+--------------+--------------------+----------+\n");
          printf("| 4            |  7.80              | %.f        |\n",quantity4);
          printf("+--------------+--------------------+----------+\n");
          printf("Total Sum: RM%.2f\n",totalSum); 
          return 0;
      }
      }
  }
  int confirmTotalSum (void)
  {
  int confirm2;
  printf("Is it correct? Enter 1 for YES to Continue ,0 for NO and Re-Enter \n");
  scanf("%d",&amp;confirm2);
  while( confirm2 ==0 )
  {
      getTotalSum();
      printf("Is it correct? (Enter 1 for YES to Continue ,0 for NO and Re-Enter) \n");
      scanf("%d",&amp;confirm2);
  }
      printf("Total Sum confirmed\n\n\n");
  return 0;
  }
  int parkingCalculator (void)
  {
  float parkingHours, totalHours,parkingFee,maxParkingFee;
  printf("Enter a parking hour\n");
  scanf("%f",&amp;parkingHours);
  totalHours = ceil(parkingHours);
  if (totalHours&gt;24)
  {
      parkingFee=0;
      printf("Parking Fee: RM %.2f\n\n",parkingFee);
  }
  else {if (totalHours==24)
       {
        parkingFee=10;
        printf("Parking Fee: RM %.2f\n\n",parkingFee);
       }
  else {if (totalHours&gt;3)
       {
        parkingFee=(2+((totalHours-3)*0.50));
        if (parkingFee&gt;10)
        {
           parkingFee=10; 
        }
        printf("Parking Fee: RM %.2f\n\n",parkingFee);
       }
  else {if (totalHours&lt;=3 &amp;&amp; totalHours&gt;=1)
       {
        parkingFee=2;
        printf("Parking Fee: RM %.2f\n\n",parkingFee);
       }
  else {if(totalHours==0)
       {
        parkingFee=0;
        printf("Parking Fee: RM %.2f\n\n",parkingFee);
       }
  
  }
  }
  }
  }
  return parkingFee;
  }
  int confirmParkingFee (void)
  {
  int confirm3;
  printf("Is it correct? Enter 1 for YES to Continue ,0 for NO and Re-Enter \n");
  scanf("%d",&amp;confirm3);
  while (confirm3 &gt;1)
  {
      printf("Error");
  }
  while( confirm3 ==0 )
  {
      parkingCalculator();
      printf("Is it correct? (Enter 1 for YES to Continue ,0 for NO and Re-Enter) \n");
      scanf("%d",&amp;confirm3);
  }
      printf("Parking Fee confirmed\n\n\n");
  return 0;
  }
  </code></pre>