String comparison [string and character array]

When comparing strings aa and bb, you can directly judge aa>bb [string is more advanced, and you can directly perform assignment, comparison, etc.]

The character array cannot directly judge aa > bb, because the character array name is the address, so the comparison is the address name, then the strcmp function in the string.h header file is needed, [such as aa<bb, strcmp(aa, bb) returns a negative value]

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324674796&siteId=291194637