Cómo restringir a un usuario para que no pueda ingresar un 0 en c
Tengo la siguiente función para filtrar valores enteros y volver a preguntar al usuario.
int checkInput0(void){
int option0,check0;
char c;
do{
printf("Enter the amount of triangles you want to check: \n");
if(scanf("%d%c",&option0,&c) == 0 || c != '\n'){
while((check0 = getchar()) != 0 && check0 != '\n' && check0 != EOF);
printf("[ERR] Invalid number of triangles.\n");
}else{
break;
}
}while(1);
// printf("returning the value of option, which is %f", option);
return option0;
Sin embargo, me gustaría extender esta función para filtrar 0 también.
Parece que me falta algo. Toda ayuda será muy apreciada.
¡Gracias por adelantado!