mardi 10 novembre 2015

logical operators in if statements not working

hi i wanted to create a simple code using if the logical operator == in if statements but its not working can anyone look at my code at tell me whats wrong with it

here is my code`

#include<stdio.h> 
main();
{
char a[15], b[15];
clrscr();
printf("Enter A String\n");
fgets(a,15,stdin);
printf("Enter Another String\n");
fgets(b,15,stdin);
if(a==b)
     printf("Match\n");
else
     printf("Does Not Match");
getch();
}

I am using this but even if i entered 2 equal values it prints "does not match" can anyone tell me whats wrong, I'm beginner at programming and im really confused whats wrong here

Aucun commentaire:

Enregistrer un commentaire