Stavo provando ad implementare tutto in una funzione che resituisse un codice di errore se il valore non era corretto:

codice:
#include <stdio.h>
#include <stdlib.h>

int checkNum();

main(){

int var;

var = checkNum();

printf("%d", var);
       
scanf("%d");

}
  
  int checkNum(){
  
         /*LEGENDA DEGLI ERRORI DI RITORNO
         
         0 = Nessun Errore
         1 = Trovati valori non numerici
         2 = Problemi con l'uso del segno
         3 = Problemi con l'uso del punto
    
       */


       int i, c, flagErr, flagEOF, flagSign, flagPoint;
       flagErr = 0;
       flagEOF = 0;
       flagSign = 0;
       flagPoint = 0;
       i=0;
       
       
       while(c!=0 && c!=10){
       
       c=getchar();
       
          if(c!=10){
       
              if((c<'0' || c>'9')  && c!='-' && c!='+' && c!='.' && c!=EOF)
       
              flagErr = 1;
     
              if(c==EOF) flagEOF = 1;  
                            
            
              if(c=='+'){
                 flagSign++;
                 
                 if(i>0)
                   flagSign++;
              }
              
              
              if(c=='-'){
                 flagSign++;
                 
                 if(i>0)
                   flagSign++;
              } 
              
               if(c=='.')  flagPoint++;   
                      
          
     //  printf("%d\n", flagEOF);                 
          }      
     
     i++;
     
     }
       
       if(flagSign>1) return 2;
       
       if(flagPoint>1) return 3;
       
       if(flagErr==1) return 1;
    
       if(flagEOF==1) printf("Hai battuto \n");    
 
  }
Ma così non funziona per niente, non aspetta neanche che inserisca un valore

Ma come mai??