Simple mistake while comparing two strings:

Even though the below statement might sound similar, you will not be getting that they are equal, since white space is also counted as an extra character. The output would be they are not equal.
if(GetMyName == GetMyName )
printf(They are equal);
printf(They are NOT equal);
you can avoid such mistakes by using the inbuilt string comparators or trim functions to trim white spaces and then compare. This would prove costly when you are passing variables in a method and have the white space.


Leave a Reply

Your email address will not be published. Required fields are marked *