Coming soon - Get a detailed view of why an account is flagged as spam!
view details

This post was deleted by Reddit.

2
Reject user input into char array if it contains a number?
Post Body

int main() {
    char userString[100];
    userInputString(userString);


    return 0;
}


int userInputString(char userString[]) {
    printf("Please enter 100 characters or less: \n");

    scanf("%s", userString);
    if ((userString <= 'a' && userString >= 'z') || (userString <= 'A' && userString >= 'Z')) {
        printf("\n%s\n", userString);
        PAUSE;
    }
    else {
        printf("Invalid input. You may only enter alphabetical characters. \n");
        PAUSE;
    }
}

I want to validate the user input so the user inputted string only contains alphabetical characters. When I run this however, it will say invalid input. Thank you for any help provided!

Author
Account Strength
100%
Account Age
7 years
Verified Email
Yes
Verified Flair
No
Total Karma
4,978
Link Karma
3,334
Comment Karma
1,459
Profile updated: 1 day ago
Posts updated: 3 months ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
2 years ago