answersLogoWhite

0


Best Answer

int string_equal (char *p1,char *p2)

{

int status = 1;

while ((*p1 *p2) && status==1)

{

if (*p1++ != *p2++) status = 0;

}

return status;

}

User Avatar

Wiki User

14y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

14y ago

The easiest way to check to see if two strings are equal is to use the strcmp function. If the result is 0, then the strings are equal:

char one [] = "One" ;
char two [] = "Two" ;

if (strcmp (one, two) == 0)
{
puts ("Equal strings") ;
}
else
{
puts ("Not equal strings") ;
}

This answer is:
User Avatar

User Avatar

Wiki User

9y ago

You use the .equals() method.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Check wheather the strings are equal?
Write your answer...
Submit
Still have questions?
magnify glass
imp