mardi 28 septembre 2021

Why is my if statement ignored even after typing hello in input [duplicate]

#include <stdio.h>

int main()
{
    char a[]=("hello");
    char b[10];
    printf("enter value: ");
    scanf("%s",b);
    if(b==a){
        printf("%s",a);
    }

    return 0;
}

when I run this code it shows me to 'enter value' as expected but when I enter 'hello' which is equal to variable 'a' it is not showing the if statement.

Aucun commentaire:

Enregistrer un commentaire