Hi guys im always running into problems when im passing variables into functions and so forth.
Im getting some sort of cast pointer from integer problem im trying to call
the validateMonth function inside getMonth()..
the call to getUserInput() works perfectly but i wont call the validateMonth i get an error does anyone know what im doing wrong?
I need the parameters to have unsigned month so i can use the variable in the validateMonth() function unsigned validateMonth(unsigned month)
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);
month = validateMonth(i);
}
while(!valid);
return EXIT_SUCCESS;
the other function:
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;
}
these are my prototypes in my .h
Code:
unsigned getMonth();
unsigned getYear();
void displayCalendar(unsigned month, unsigned year);
char* getUserInput(char *prompt);
unsigned validateMonth(unsigned month);
void readRestOfLine();