mardi 20 octobre 2020

What is the meaning of the Error due to empty character constant in C?

Executing this code in Dev C++ (Windows). Don't know what to do with the error!

     #include <stdio.h>
     int main(void)
    {
        int blanks = 0, digits = 0,letters =0,others=0;
        int c; 
        while ((c=getchar()) !=EOF) 
        {
            if ( c =='') // **Error due to empty character constant**
                ++blanks;
            else if (c>='0' && c<='9')
                ++digits ;
            else if ( c>='a' && c<='z' || c>='A' && c<='Z') 
                ++letters;
            else 
                ++others;
        }
        printf(" blanks=%d , digits =%d , letters =%d",blanks ,digits , letters );
        printf("others =%d\n\n",others);
        return 0;
    }

Aucun commentaire:

Enregistrer un commentaire