i need this function in a program i'm writing
it checks the password you enter and provides access to another part(not shown here).
when i enter the set password(aaaaaa) while running the program, it goes to the else case and says incorrect password and returns 0. I tried running the program by using gets(pass); and that worked but that's not a proper way to enter a password...
help would be sincerely appreciated.
Your password does not terminate with null char, therefore it is not a c-string.
First solution: change strcmp to memcmp("aaaaaa", pass, 6)
Second solution: char pass[7]; pass[6] = 0;