C program for compare two strings , C/C++ Programming

void main()

{

          char n[100],n1[100];

          int i,j;

          clrscr();

          printf("ENTER THE FIRST STRING: ");

          scanf("%s",n);

          printf("ENTER THE SECOND STRING: ");

          scanf("%s",n1);

          for(i=0,j=0;n[i]!='\0';i++)

          {

                   if(n[i]!=n1[i])

                   j=1;

          }

          if(j==0)

          printf("THE TWO STRING ARE EQUAL");

          else

          printf("THE TWO STRING ARE NOT EQUAL");

          getch();

}

 


OUTPUT :

ENTER THE 1 STRING: KAMLESH

ENTER THE 2 STRING: KAMLESH

 

THE TWO STRING ARE EQUAL

 

Posted Date: 9/10/2012 2:59:53 AM | Location : United States







Related Discussions:- C program for compare two strings , Assignment Help, Ask Question on C program for compare two strings , Get Answer, Expert's Help, C program for compare two strings Discussions

Write discussion on C program for compare two strings
Your posts are moderated
Related Questions


Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b. The area under a curve between two points can b

palindrome program with minimum character replacements

Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b. The area under a curve between two points can b

recsection method source code for searching position

question c

Arguments Passing Mechanism C++ supports the following argument passing mechanisms: i).  Pass by value: A copy of the arguments value is made and passed to the called functio

flow chart for prime or not

Program of swapping two varibales: void swap(int *, int *);   // This is swap's prototype int main() {                 int x = 5, y = 7;                 swap(&x, &