I have a question on why my code wont compile when i use strcmpi. I tested this same code with strcmp and that worked. Not sure why this does not work.
here is the compile error i get :
gcc -std=c99 strcmpi_test.c -o strcmpi_test
strcmpi_test.c: In function 'main':
strcmpi_test.c:15: warning: implicit declaration of function 'strcmpi'
strcmpi_test.c:30:2: warning: no newline at end of file
/tmp/cceKXLcn.o: In function `main':
strcmpi_test.c:(.text+0x50): undefined reference to `strcmpi'
collect2: ld returned 1 exit status
#include <stdio.h>
#include <string.h>
int main()
{
char name[10];
char name2[10] = "bob";
printf("what is your name : ");
fgets(name,10,stdin);
if(strcmpi(name,name2) == 1)
{
printf("name == %s name2 == %s your names are the same\n",name,name2);
} else {
printf("name == %s name2 == %s your names are NOT the same\n",name,name2);
}
return 0;
}