function calling

musicmancanora4's Avatar
Go4Expert Member
I just want to be able to successfully call the validate Month function inside the getMonth function.. it works when i call getUserInput() but i get type cast errors if i try it with this function. Any idea as to how i can write it up? thnxs




Code:
unsigned getMonth()
{
   
   /*** declare variables*/
  
  unsigned  i;
  int  valid = 0;
  char *prompt = "Please enter a month between 0 - 12\n";
  char *month;
  
  
  
  do
  {
  
  month = getUserInput(prompt);
  /* in here i want to call the validateMonth() fucntion*/

  }
  while(!valid);
  /*printf("hello %s",month);*/
  /*printf("Please enter a month between 0 - 12\n");*/
  
 
   
   return EXIT_SUCCESS;

}
Code:
unsigned validateMonth(unsigned month)
{
     unsigned m;
     while(month<0 || month>12)
     {
        
        printf("Month error 0 or less or equal to 12 please\n");
        
     }

     return m;
}
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Duplicate thread of function calling. Closing the thread..