C program compare two strings using strcmp function

Compare two strings

#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
char x[100],y[100];
printf("Enter first word:- ");
gets(x);
printf("Enter second word:- ");
gets(y);
if(strcmp(x,b)==0)
 {
  printf("strings are equal");
 }
else
{
 printf("Strings are not equal");
}
getch();
}

OUTPUT:-

When strings are equal

compare two strings

When strings are not equal

compare two strings

Strings are case sensitive hence in second output we are getting result “string are not equal” because in first word “f” is in lowercase and in second word “F” is in upercase.

22 comments on “C program compare two strings using strcmp function

  1. Cindi

    That is a really good tip particularly to those new to the blogosphere.
    Simple but very accurate information… Many thanks
    for sharing this one. A must read article!

    Reply
  2. admin Post author

    Thanx for your feedback on the post C program compare two strings using strcmp function.This comment means a a lot to us.

    Reply
  3. máy làm mát phòng ngủ

    This design is wicked! You definitely know how to keep
    a reader entertained. Between your wit and your videos, I was almost moved to start my own blog (well, almost…HaHa!) Wonderful job.

    I really loved what you had to say, and more than that,
    how you presented it. Too cool!

    Reply
  4. gold market

    Hello! Would you mind if I share your blog with my facebook group?
    There’s a lot of folks that I think would really enjoy your content.
    Please let me know. Many thanks

    Reply
  5. click here

    I read this piece of writing completely
    on the topic of the comparison of most up-to-date and preceding technologies, it’s remarkable article.

    Reply
  6. lamsocial.net

    I think this is one of the most important info for me. And i’m
    glad studying your article. But wanna commentary on some basic things, The site
    taste is perfect, the articles is really nice :D. Excellent
    activity, cheers.

    Reply
  7. quick loans uk

    Hello! This post couldn’t be written any better! Reading this
    post reminds me of my old room mate! He always kept talking about this.

    I will forward this post to him. Pretty sure he will have a good read.
    Thank you for sharing!

    Reply
  8. kotyl

    Having read this I believed it was rather enlightening.
    I appreciate you taking the time and energy to put this content together.

    I once again find myself personally spending way too much time both reading
    and commenting. But so what, it was still worthwhile!

    Reply
  9. obat penumbuh rambut

    Appreciating the time and effort you put into your
    website and detailed information you offer. It’s good to come across a blog every once in a while that isn’t the same unwanted rehashed material.
    Wonderful read! I’ve saved your site and I’m including your RSS
    feeds to my Google account.

    Reply
  10. Jennifer

    Your style is unique compared to other folks I’ve read stuff from.
    Many thanks for posting when you’ve got the opportunity, Guess I’ll just book mark this web site.

    Reply
  11. Fire Retardant Clothing

    hi!,I love your writing so a lot! proportion we keep in touch
    extra approximately your article on AOL? I require a specialist
    on this house to unravel my problem. Maybe that
    is you! Taking a look forward to peer you.

    Reply
  12. FIFA55

    Heya! I’m at work surfing around your blog from
    my new iphone! Just wanted to say I love reading
    your blog and look forward to all your posts! Keep up the fantastic work!

    Reply
  13. best crytocurrency to buy now northwest

    Hello there! This is kind of off topic but I need some help from an established blog.
    Is it very difficult to set up your own blog?

    I’m not very techincal but I can figure things out pretty fast.
    I’m thinking about setting up my own but I’m not sure where to start.
    Do you have any tips or suggestions? Thank you

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *