So I am trying to create the program that I mentioned in the title, but there is one problem with it. Here is the code.
#include <stdio.h>
#include <stdlib.h>
int main()
{
char input[30];
char array[][10] = {"One", "Two", "Three"};
printf("Enter input.\n");
scanf("%s", input);
if(input == array[0]){
printf("Array 0");
} else if(input == array[1]){
printf("Array 1");
} else if(input == array[2]){
printf("Array 2");
} else {
printf("Incorrect.");
}
return 0;
}
The problem is that for example when I enter "One", it prints "Incorrect" instead of "Array 0". The same thing happens when I input "Two" or "Three". It doesn't work the way I intend it to be. I want it to print "Array 0" when I type "One", "Array 1" when I type "Two", and so on.