我使用该功能isspace
在单词中搜索空格。问题是我在程序构建时收到一条错误消息:
"argument of type char* is incompatible with parameter of type int"
int const bufferSize = 256;
newItemIDPointer = (char*)malloc(bufferSize * sizeof(char));
if (newItemIDPointer == NULL)
{
printf("Didnt allocate memory!");
exit(EXIT_SUCCESS);
}
printf("Enter new Item ID: ");
scanf_s(" %[^'\n']s", newItemIDPointer, bufferSize);
stringLength = strlen(newItemIDPointer);
newItemIDPointer = (char*)realloc(newItemIDPointer, size_t(stringLength + 1));
int i = 0;
int count = 0;
while ((newItemIDPointer + i) != '\0')
{
if (isspace(newItemIDPointer + i))
{
count++;
}
i++;
}
我的代码中的实现有什么问题,isspace
如何修复此错误消息?