Judge whether the strings are equal or not ==

Insert picture description here
Insert picture description here
why? It is because ==the memory addresses of two objects are compared. We know that when the variable is created, it is equivalent to opening up space in the memory . In the case, the strsum str1is two different spaces occupied, so their memory addresses are inconsistent. in use ==, when the symbol is determined on not equal , and that is false.

Solution

Insert picture description here

Guess you like

Origin blog.csdn.net/qq_45783660/article/details/114034399