ISO C forbids comparison between pointer and integer [-fpermissive]

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/csdn0006/article/details/82386157

错误代码:
S = “a##c”;

if(S[i] == "#"){
    if(s.length()!=0)
        s.pop_back();
}

异常:ISO C forbids comparison between pointer and integer [-fpermissive]
意思是:指针和整数比较出错;禁止指针和整数进行比较。
S[i]是字符,”#”表示一个字符串的首地址。

改正:

if(S[i] == '#'){//字符之间相互比较
    if(s.length()!=0)
        s.pop_back();
}

猜你喜欢

转载自blog.csdn.net/csdn0006/article/details/82386157