here i am attaching a program in c , i don't know how to compare a string from user . so my compiler is not entering in if condition .
#include
#include int main(int argc, char const *argv[]) {
char subject1;
char subject2;
printf("enter the subjects\n");
scanf("%s",subject1);
scanf("%s",subject2);
printf("you have entered %s\n",subject1);
printf("you have entered %s\n",subject2);
if (subject1=="maths" && subject2=="science")
{
printf("you have entered both maths and science\n");
}
else
{
printf("wrong subject\n");
}
getch(); return 0; }
No responses yet.