Originally Posted by
jamal
i have two arrays one is a text file "month1" and the other is user defined "month". my purpose is to compare the month entered by the user to the month in the array if they are the same allow the rest of code to execute if not ask the user to enter another month.
Code:
printf( "Enter Month: " );
scanf( "%s", Month );
if (strncmp(Month, month1, 7) ==0)
{prinf("not the same");
actually when strcmp() or strncmp() returns 0 they *are* the same...
Code:
printf( "Enter Month: " );
scanf( "%s", Month );
if (strncmp(Month, month1, 7) !=0)
{
printf("not the same");
}
Also keep in mind that this is CaSe SeNsItIvE ... January is not the same as january.