The C function ________ is used to compare two strings lexicographically.
- strcmp
- strncmp
- strcompare
- strcasecmp
The correct answer is strcmp. This function compares two strings character by character and returns an integer value representing their lexicographical order. strncmp is used for comparing a specific number of characters, and the other options are not valid C functions.
Loading...
Related Quiz
- How can you determine if you have reached the end of a file while reading it in C?
- When declaring a variable in C, what does the 'static' keyword do to the variable's lifetime?
- What is the impact of using inline functions on the size of the compiled binary?
- What function is used to open a binary file for both reading and writing in C?
- The ________ statement is used to skip the rest of the loop's body and continue with the next iteration.