Compare two Strings(Character Array):- Function used- strcmp .This function is used to compare two string. Q)Write a program to enter t...
Compare two Strings(Character Array):-
Function used-strcmp.This function is used to compare two string.
Q)Write a program to enter two string and compare two strings.
Note:-You can also create this program in c++(c plus plus),java,c#(c sharp) languages etc. with the same logic(Functions may be differ).
Function used-strcmp.This function is used to compare two string.
Q)Write a program to enter two string and compare two strings.
Note:-You can also create this program in c++(c plus plus),java,c#(c sharp) languages etc. with the same logic(Functions may be differ).
P:void main()
{
char string1[40],string2[40];
printf("Enter first String");
gets(string1);
printf("Enter second String");
gets(string2);
if(strcmp(string1,string2)==0)
printf("String is equal");
else
printf("String is not equal");
}
If you have any query then leave your comments and don't forgot to follow me on Google+,Facebook,Twitter.
COMMENTS