Name
strcmp function — Compares strings
Synopsis
int strcmp(const char* s1, const char* s2)
The strcmp
function
compares two null-terminated strings as arrays of unsigned
char
. If the strings are equal, the return
value is 0
. Otherwise, the return
value is positive if s1
is
greater than s2
or negative if
s1
is less than s2
. If one string is a prefix of the
other, the longer string is greater than the shorter string.
See Also
memcmp function, strncmp function, wcscmp
in <cwchar>
Get C++ In a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.