char* getUserInput(char *prompt, char*result)
result = fgets(buff, BUFF_SIZE, stdin);
if(result == NULL)
printf("Error please enter the input again!\n");
else if(result[strlen(result)-1] != '\n')
whats with readrestofline()?
and u have to remember that result is a char * which points to a string,its not a number,so u have to use atoi to convert it to a number.
this bit of code is the most impressive part,but it will work.
unsigned validateMonth(unsigned month, char *prompt)
int flag = FALSE; /* false value*/
while(flag == TRUE || month<0 || month>12) /* flag 1 for true*/
flag = FALSE;
printf("Month error 0 or less or equal to 12 please\n");
alrite m was never assigned anything? why have the function return an unsigned? or perhaps u r later going to have a use for a m?
>tmpMonth = validateMonth(valMonth, prompt);
/*** declare variables*/
int valid = 0;
char *prompt = "Please enter a month between 0 - 12 !\n";
month = getUserInput(prompt);
tmpMonth = validateMonth(valMonth, prompt);
valMonth was never assigned anything.
change the month to a number using atoi and then assign it to valmonth.
and i suppose u have read a bit too much on MODULARITY.