Quote Originally Posted by Bandizzle View Post
I'm very new to C programming. My only other programming experience is Python Programming. I have an assignment in my programming class that involves comparison of strings, so I figured I'd write a little test program to see if I'm capable of doing that...
So far I've been unsuccessful.... I tried to compare two strings, but even if they appear exactly the same, my program doesn't seem to agree.

Here's the code...

Code:
#include <stdio.h>
int
main(void)
{
        char* string;
        char* comp = "dummy";

        printf("Enter a string: ");
        scanf("%s", string);

        printf("The string you entered is %s.\n", string);
        printf("The string you are comparing to is %s.\n", comp);

        if(string == comp)
                printf("The strings match!\n");
        else
                printf("The strings don't match!\n");

        return (0);
}
And here's what my output looks like...

Code:
Enter a string: dummy
The string you entered is dummy.
The string you are comparing to is dummy.
The strings don't match!
I don't know what I'm doing wrong. >_< Can anyone help me?
strcmp()