May I need help in sorting this out? Basically, I'm tasked to play around with ctype header files. I get input from the user and then I give the output depending on the input provided.
#include <stdio.h>
#include <string.h>
#include <ctype.h>
int main(void)
{
    char savedPassword[] = "123456";
    char username[100], password[100], charInput, decision;
    printf("Username: ");
    fgets(username, sizeof(username)/sizeof(username[0]), stdin);
    printf("Password: ");
    scanf(" %s", &password);
    if (strcmp(savedPassword, password) == 0)
    {   
        printf("Welcome, %s\n", username);
        do
        {
            printf("Enter any character: ");
            scanf(" %c", &charInput);
            if(isalpha(charInput))
            {
                if(isupper(charInput))
                {
                    printf("%c is a capital letter.\n", charInput);
                } else {
                    printf("%c is a small letter.\n", charInput);
                }
            } else if (isdigit(charInput))
            {
                printf("%c is a digit.\n", charInput);
            } else if (ispunct(charInput))
            {
                printf("%c is a punctuation.\n", charInput);
            } else if (isspace(charInput))
            {
                    printf("%c is a space.\n", charInput);  
            }
            printf("Do you want to exit (Y/N)? ");
            scanf(" %c", &decision);
            if (toupper(decision) != 'Y' && toupper(decision) != 'N')
            {
                printf("Please re-enter the correct response.\n");
                printf("Do you want to exit (Y/N)? ");
                scanf(" %c", &decision);
            }
        }while(toupper(decision) != 'Y');
        printf("Thank you for using the app!");
    } else {
        printf("Wrong password! Try again!");
    }   
    return 0;
}
I couldn't make isspace() work because it seems like scanf() doesn't detect the whitespace anymore as I have used one before the placeholder.
Thank you!
