Friday, April 1, 2011

Can you explain this C++ program?

I'm not too familiar with C++, but I'd suspect that since s1 and s2 are just pointers to char (i.e. char*), the == operator will be comparing the pointers' addresses, which won't match. The two char arrays have the same content, but they aren't the same array.

No comments:

Post a Comment