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
The concept of a string in C is difficult, because a string is a collection of characters stored in memory terminated by a NULL string i.e. \0. Let us consider the string Hello. Th

Q: But operator overloading makes class look ugly; isn't it assumed to make my code clearer? A: Operator overloading makes life simpler for the users of a class, not for develop


Programming Assignment #3: Vehicle Track Performance Tests Purpose: The purpose of this programming assignment is to give the student experience in using functions, arrays, and str

Project Description: I need to convert AFL code of Amibroker to DLL plugin to hide original formula, and also to protect the DLL and making it hardware locked. I need to wrap th

how to find minimum number if shelves required

Optimized NIC Driver for Windows Compact 7 for Hard Real Time Communication Project Description: I am seeking an optimized driver (miniport driver) that will be used for sele

explain the function of five elements that are found on a motherboard#


(a) Write a procedure called (mult x y) that multiplies two numbers x and y in a recursive manner using successive addition. Specifically, note that a x b = a + a + .... + a (b tim