Q:

String compare in C

0

String compare in C

 

How to compare strings in C? You can use do it , Function strcmp is case sensitive and returns 0 if both the strings are same.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

#include 
#include 
int main()
{
   char a[100], b[100];

   printf("Enter a string\n");
   gets(a);

   printf("Enter a string\n");
   gets(b);

   if (strcmp(a,b) == 0)
      printf("The strings are equal.\n");
   else
      printf("The strings are not equal.\n");

   return 0;
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now