459 views

1 Answer

Best answer
3 votes
3 votes

Inside if condition checks if string1 equal to string2

Now, string1 and string2 are two pointers here, contains starting address of both arrays.

Now, address of two strings cannotbe equal,

So,both pointer returns two different value.

These cannot be equal.

So, it simply go else part of program, and prints whatever written there.

It would have been equal if the if condition were

if(*string1 == *string2)
edited by