Programming with C

⌘K
  1. Home
  2. Docs
  3. Programming with C
  4. Functions and Pointers
  5. Built-in functions
  6. String Compare without case

String Compare without case

Use of strcmpi( ) function

#include<stdio.h>
#include<string.h>
int main()
{
	char s1[20], s2[20];
	int res;
	puts("Enter string 1:");
	gets(s1);
	puts("Enter string 2:");
	gets(s2);
	res = strcmpi(s1,s2);
	if(res == 0)
	{
		printf("strings are equal\n");
	}
	else
	{
		printf("strings are unequal\n");
	}
}

Output

Enter string 1:
hello
Enter string 2:
Hello
strings are equal

Views: 0

How can we help?

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments