samedi 7 novembre 2020

C - if with more than 1 OR

I've written a function to check if a string array is a name (every char can only be a->z or A->Z or space) However if I run my program it doesn't work properly. If I try to debug it, I see that it jumps to the line return 0; even if the first char in the array is 'M'. Can anyone help me?

int je_meno(char array[]) {
    int i=0;
    while(array[i]!=0){
        if(array[i]<32 || 32<array[i]<65 || 90<array[i]<97 || 122<array[i]){
            return 0;
        }
        i++;
    }
    return 1; }

Aucun commentaire:

Enregistrer un commentaire