Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

C Program to Compare Two Strings With Output

c programs

In this Program, we are going to share how to compare two strings using c programming language. If you are a beginner and want to start learning the c programming, then keep your close attention in this tutorial as I am going to share a c program to compare two strings.

C program to compare two strings with output

Copy the below C program and execute it with the help of C compiler. At the end of this program, We have shared the output of this program.

#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;
}

Enter the first string
Webmentor
Enter the second string
Webmentors
Entered strings are not equal.

The post C Program to Compare Two Strings With Output appeared first on FreeWebMentor.



This post first appeared on Programming Blog Focused On Web Technologies, please read the originial post: here

Share the post

C Program to Compare Two Strings With Output

×

Subscribe to Programming Blog Focused On Web Technologies

Get updates delivered right to your inbox!

Thank you for your subscription

×