简体   繁体   English

在 C 程序中显示错误:警告:指针和整数之间的比较

[英]Showing error in C program : warning: comparison between pointer and integer

#include <stdio.h>
#include <strings.h>

int main()
{
    
    char a;
    printf("Enter the traffic signal light :");
    scanf("%c", &a);

    if(a=="Red")
    {
        printf("STOP!!!");
    }
    else
    {
        printf("GO!!!");
    }
    return 0;
}

//I am in the beginning stage of coding. //我处于编码的开始阶段。 I am unable to understand the error, kindly please guide me.我无法理解错误,请指导我。

您将a声明为char并与字符串“RED”进行比较?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM