Comparing Two Strings
Learn how to compare two strings in C.
We'll cover the following
The strcmp()
function
The strcmp( )
function is used to compare whether or not two strings are equal. The basic syntax of the strcmp()
function is given below:
int strcmp(const char *str2, const char *str1);
The order of passing base addresses to strcmp( )
must always be the target, followed by the source.
Get hands-on with 1400+ tech skills courses.