When I execute and put in the response "YES" or "NO.", the program always outputs "Not a valid response."
from the else{} statement.
#include<stdio.h>
#include<stdlib.h>
int main()
{
int response[3];
char password[15];
printf("Insert Password with 8 characters:");
gets(password);
printf("Your current password is:'%s',do you want to keep it?(YES or NO.):",password);
gets(response);
if (response == "YES") {
printf("password stored 'not actually lol'\n");
}
else if (response == "NO.") {
printf("we dont know what else you want to do.\n");
}
else {
printf("Not a valid response.\n");
}
return 0;
}
It doesnt even work when the program doesnt take input from the user, I think there is a problem with the if statement but I'm not sure
#include<stdio.h>
#include<stdlib.h>
int main()
{
int response = "NO.";
char password[15];
printf("Insert Password with 8 characters:");
gets(password);
printf("Your current password is:'%s',do you want to keep it?(YES or NO.)\n",password);
//gets(response);
if (response == "YES") {
printf("password stored 'not actually lol'\n");
}
else if (response == "NO.") {
printf("we dont know what else you want to do.\n");
}
else {
printf("Not a valid response.\n");
}
return 0;
}