警告:条件表达式中的指针/整数类型不匹配

Alv*_*vin 0 c pointers

以下代码正在抛出

"警告:条件表达式中的指针/整数类型不匹配".

我该怎么解决这个问题?

#include<stdio.h>

int main()
{
    char *str = "Error";
    char *sch_str="pqrs";
    int i=1;

    if (i >= 0)
            str = (sch_str[i] != NULL) ? sch_str[i] : "Unknown";


    printf("%c\n",sch_str[i]);
    printf("%s\n",str);

    return 0;
}
Run Code Online (Sandbox Code Playgroud)

Sou*_*osh 5

1. sch_str[i]不是指针.无法与之比较NULL.
2.不能把[赋值] sch_str[i]放入str