Tag: c以

指针和整数之间的警告比较

当我遍历字符指针并检查指针何时到达空终止符时,我收到错误。 const char* message = “hi”; //I then loop through the message and I get an error in the below if statement. if (*message == “\0”) { …//do something } 我得到的错误是: warning: comparison between pointer and integer (‘int’ and ‘char *’) 我认为message取消引用消息前面的* ,所以我得到消息指向的值? 顺便说一句,我不想​​使用库函数strcmp 。