我需要比較兩個字符串是否相等(不區分大小寫),但我的實現在編譯時返回了很多警告。將字符串轉換爲小寫字母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;
我得到這些警告:
warning: passing argument 1 of ‘tolower’ makes integer from pointer without a cast [enabled by default]
note: expected ‘int’ but argument is of type ‘char *’
initialization makes pointer from integer without a cast [enabled by default]
我怎樣才能實現這個
你應該閱讀的tolower的'文檔()'。 – 2013-07-27 16:29:16
'tolower'處理單個字符 –