बिजनेस मार्केटिंग का लो कॉस्ट फंडा , अपने मोबाइल से ऑटो sms भेजकर मार्केटिंग करे विजिट करे http://autotextsms.com/ बिजनेस मार्केटिंग का लो कॉस्ट फंडा http://autotextsms.com/

Search This Blog

Translate

C program example to compare two string without using library function

C program to compare two string without using library function,C program to compare two string  without using library function with source code, C program to compare two string using function, recursion, pointer with source code, check string are equal or not, find maximum and minimum string, c program to check two words are equal or not


#include
#include
void main()
{
 char s[100],s1[100];
 int i,j,l1,l2,flag=0;
 clrscr();
 printf("enter 1st string");
 gets(s);
 printf("enter 2nd String");
 gets(s1);
 for(i=0;s[i]!='\0';i++) ;
 l1=i;
 for(j=0;s1[j]!='\0';j++) ;
 l2=j;

 printf("\n length of %s = %d",s,i);
  printf("\n length of %s = %d",s1,j);
 if(l1==l2)
 {
  for(i=0;s[i]!='\0';i++)
   if(!(s[i]==s1[i]))
   {
    flag=1;
    break;
   }
 }
 else
 flag=1;


       if(flag==1)
printf("\n string are not equal");

if(flag==0)
printf("\n string are equal");

 getch();
 }

C Program example List