0

there is a function called strcmpi in string.h and is working fine in windows but when i try the same in linux, it thows an error

warning: implicit declaration of function ‘strcmpi’; did you mean ‘strcmp’? [-Wimplicit-function-declaration]
    6 |     a = strcmpi("Ather","athEr");
      |         ^~~~~~~
      |         strcmp
#include<stdio.h>
#include<string.h>
int main()
{
    int a;
    a = strcmpi("HEllO","heLLo");
    printf("%d\n",a);
    return 0;
}
Ather
  • 1
  • 1
  • 1
    `strcmpi` is non-standard, probably MS-invented. On Linux there's `strcasecmp` that fits as an exact replacement. – iBug Dec 18 '22 at 03:47
  • There is no `strcmpi` on Linux, it's not portable (see [the source](https://github.com/torvalds/linux/blob/master/include/linux/string.h#L48)). It's also [deprecated](https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/strcmpi?view=msvc-170) on Microsoft platforms, and you should use `_stricmp` there. – Zac Anger Dec 18 '22 at 03:48
  • Does this answer your question? [Is the function strcmpi in the C standard libary of ISO?](https://stackoverflow.com/questions/9618697/is-the-function-strcmpi-in-the-c-standard-libary-of-iso) – iBug Dec 18 '22 at 03:48
  • 1
    See also this duplicate: [Case Insensitive String Comparison in C](https://stackoverflow.com/questions/5820810/case-insensitive-string-comparison-in-c) – Zac Anger Dec 18 '22 at 03:49

0 Answers0