the purpose is to verify the user input, and sent error message if they enter integer when I asking for string, or enter string when I asking for integer, or any other weird symbol etc.
could anyone get me a full version of the example to demonstrate how to test for:
1.test for float type ( input ) 2.test for string type ( input ) 3.test for character type ( input )
and under below is my code for testing integer:
int getAge(){
int x;
puts("please enter your age:\n\n");
x = scanf("%d",&age);
if (x == 1){
printf("You have entered :%d",age);
return (age);
}
else {
wrongInput();
}
}