This is just a piece of the code but I believe the problem the is in the function where '\n' is read along with the input, therefore everthing is FLASE. (please tell me if Im wrong.) So I tried to allow \n butDidnt work either. Any suggestions are welcome. ThnxCode:if (( !isdigit ( *max++)) && max != '\n')

Code:static int validate_whole ( char *max ) { while ( *max != '\0' ) if ( !isdigit ( *max++) return BOOL_FALSE; return BOOL_TRUE; } int main (void) { int maxnum; char max[BUFSIZ]; printf("How many numbers would you like to sort [2-20]: "); fgets( max, BUFSIZ, stdin); while( validate_whole (max) == BOOL_FALSE ) { printf("Invalid entry, The number must be between 2 and 20\n"); printf("\nHow many numbers would you like to sort [2-20]: "); fgets( max, BUFSIZ, stdin); } #if 1 //maxnum = atoi( max ); sscanf(max, "%d", &maxnum ); #endif