I'm having a little problem regarding this log-in program.

#define p printf
#define s scanf


    char pass[20];
    char user[20];


    p("\nEnter your username: ");
    s("%s", user);

    p("\n\nEnter your password: ");
    s("%s",  pass);

    if(user=="abel" && pass=="pass")
        p("\nW E L C O M  E !!");
        p("\nINVALID INFORMATION!!");

  return 0;

Even if I enter the correct username (user) and password(pass), it would still goes directly to the else statement. Logic error, or am I missing something.


if(user=="abel" && pass=="pass")

Look up how to compare strings again. You need to use strcmp()

And remove your 2 #define's. They make the code harder to understand, not easier.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.