plz help me with simple string comparison.
i have no idea why this isn't working.. plz plz help a guy out.
Code:
char monthNames[2][10] = {"jan", "feb"};
char monthSelection[10];
// printf(monthNames[0]);
int check = 0;
while(check != 1)
{
printf("Enter the month: (e.g. January ) ");
gets(monthSelection);
printf(monthSelection);
printf(monthNames[0]);
// for (int i = 0; i < 2; i++)
// {
if (monthSelection == monthNames[0])
{
printf("correct");
check = 1;
break;
}
// }
}
in the end i want the program to check to see if the input exists in the array. i was thinking of using a for loop to check every element of the array.. but i can't even get this script to work..