Hey guys im having trouble returning to the top of the do while loop if an invalid entry is been entered.. It keeps falling out could someone help me please?
Code:
#define FALSE 0
#define TRUE 1
do
{
fgets(buff, BUFF_SIZE, stdin);
*month = atoi(buff); /** ascii to integer conversion**/
if(*month >0 && *month <12)
{
printf("Valid month entry\n");
return TRUE;
}
else
{
printf("Invalid month entry\n");
return FALSE;
}
printf("dude");
/* getting rid of the newline char the enter key when
running the program*/
/*locate newline in buff [a][b][\n]*/
/**month = strlen(buff) -1;*/
/* check if it is a newline char*/
/*if(buff[*month] == '\n')
{
buff[*month] = '\0';
} */
/* change it to null end of array[a][b][\0]*/
}
while(*month<0 && *month>12);