I have a code that if the user key in "what is apple" it should answer "apple is a fruits" but for this case the what is stored as [what] in a text file. Look like this
[what]
apple = apple is a fruits.
below is my codes. It doesnt print out " apple is a fruits". Can i know where is my error?
char intent[255];
char key1[255];
char key[255];
char inv[3][10] = { "what","where","who" };
snprintf(intent, sizeof(intent), "[%s]", inv[0]);
printf("%s\n", intent);
scanf("%s",&key1);
if (strcmp (intent == "[what]" && key == "apple") == key1) {
printf ("apple is a fruits");
}