C Program to Compare Two Strings Without Using Library Function
#include<stdio.h> #include<conio.h> void main() { char str1[30],str2[30]; int i; printf("\n Enter two strings :"); gets(str1); gets(str2); //loop for comparison i=0; while(str1[i]==str2[i] && str1[i]!='\0') i++; if(str1[i] > str2[i]) printf("\nstr1 > str2"); else if(str1[i] < str2[i]) printf("\nstr1 < str2"); else printf("\nstr1 = str2"); getch(); }
Incoming search terms:
- c program to compare two strings without using strcmp (7)
- program to compare two strings in c without using strcmp (3)
- c program to compare two strings (3)
- string comparison in c without using strcmp (2)
- WAP TO COMPARE TWO STRINGS WITHOUT USING STRING H HEADER FILE (2)
- compare two strings without using the strcmp function (2)