当我遍历字符指针并检查指针何时到达空终止符时,我收到警告。
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
dereferences message,那么我得到message指向的值呢?顺便说一句,我不想使用库函数strcmp
。