strcmpi() string handling functions - C-Tutorial

Latest

Friday, 7 October 2016

strcmpi() string handling functions

C- strcmpi() function   

  • It refers to string comparison ignore case function.



            
            The general format of strcmpi() function is:

            Syntax:           strcmpi(string1 , string2);

            Function is used to compare the given two strings without case consideration.                   

/* PROGRAM TO COMPARE THE GIVEN TWO STRINGS WITHOUT CASE */

#include<stdio.h>
#include<conio.h>
#include<string.h>
main()
{
            char str1[50],str2[50];
            clrscr();
            printf("\nEnter string 1:");
            gets(str1);
            printf("\nEnter string 2:");
            gets(str2);
            if((strcmpi(str1,str2))==0)
                 printf("\nBOTH STRIGNS ARE SAME");
            else
                 printf("\nBOTH STRINGS ARE DIFFERENT");

}

No comments:

Post a Comment