C Program To Know Weather The Strings equal or not (user defined function)

#include<string.h>
#include<stdio.h>
#include<conio.h>
void main()
{
char s1[100],s2[100];
int i,flag=0;
clrscr();
printf("S1:");
gets(s1);
printf("S2:");
gets(s2);
for(i=0;s1[i]!=' ';i++)
{
 if(s1[i]!=s2[i])
 {
 flag=1;
 break;
 }
}
if(flag==0)
puts("Equal");
else
puts("Not Equal");
getch();
}

Bhanu Namikaze

Bhanu Namikaze is an Ethical Hacker, Security Analyst, Blogger, Web Developer and a Mechanical Engineer. He Enjoys writing articles, Blogging, Debugging Errors and Capture the Flags. Enjoy Learning; There is Nothing Like Absolute Defeat - Try and try until you Succeed.

No comments:

Post a Comment