简体   繁体   中英

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”进行比较?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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