Como restringir um usuário para não poder inserir um 0 em c
Eu tenho a seguinte função para filtrar valores inteiros e solicitar novamente ao usuário.
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;
No entanto, eu gostaria de estender essa função para filtrar 0 também.
Parece que estou perdendo alguma coisa. Toda ajuda será muito apreciada.
Desde já, obrigado!