I am almost completely brand new to programming (been in my first programming class for about a month), and I am trying to learn stuff that my professor isn't teaching yet so that I don't get behind later, and I am doing this by writing simply programs and learning all the stuff I need to learn to make them.
With this program below I want it to have a saved username and password and basically all I want is for someone to enter username and password, and for it to check if they are correct, and if so print a little message, if not print a message showing they weren't right.
The errors I am getting for this bit of code are
NE.c: In function `main':
NE.c:16: error: assignment of read-only location
NE.c:16: error: incompatible types in assignment
NE.c:19: error: incompatible types in assignment
Thanks for any help,
Tyler
#include <stdio.h>
#define username_1 "greg"
#define password_1 "going"
int main(void) {
char usercheck[256];
char password[256];
printf("What is your username? ");
gets(usercheck);
if (username_1=usercheck) {
printf("What is your password? ");
gets(password);
if (password = password_1) {
printf("You May Enter!\n");
}
}
else {
printf("access denied.\n");
}
return 0;
}