I'm trying to write a function that will take an input and return it when it is valid
The function is constantly printing the error message even if the input is correct.
How can I pass the argument through to verify without it being evaluated as boolean beforehand?
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char verify(char argument[256]){ //function to check an input is valid
char input;
while(1){
input = getchar();
while(getchar()!='\n'); //clear buffer
if(argument){
break;
}
printf("That is not a valid input. Try again: "); //error message
}
return input;
}
int main(void){
char input;
printf("Enter an alphabetical input: ");
input = verify(input>64&&input<91||input>96&&input<123); //checks to see if the ASCII value of the input corresponds to a alphabetical char
printf("Input is: %c",input);
return 0;
}