小编Fun*_*kyT的帖子

在c中转换为小写后比较字符串

我需要比较两个字符串的相等性(不区分大小写)但我的实现在编译时返回了很多警告.

我的实施:

//The word array will contain any number of strings of varying lengths
//string is the word to compare to
char **wordArray, char*string;

int i, sizeOfArray = 10

for(i = 0; i < 10; i++)
{
    //Return 1 if the string is seen in the array 
    if(strcmp(tolower(wordArray[i]), tolower(string)) == 0)
        return 1;
}

return 0;
Run Code Online (Sandbox Code Playgroud)

我收到这些警告:

warning: passing argument 1 of ‘tolower’ makes integer from pointer without a cast [enabled by default]

note: expected ‘int’ but argument is of …
Run Code Online (Sandbox Code Playgroud)

c strcmp tolower

0
推荐指数
1
解决办法
3153
查看次数

标签 统计

c ×1

strcmp ×1

tolower ×1