Which function would you use to compare two strings lexicographically in C?
- strcat()
- strcmp()
- strcpy()
- strlen()
You would use the strcmp() function to compare two strings lexicographically in C. It returns 0 if the strings are equal, a positive value if the first string is greater, and a negative value if the second string is greater.
Loading...
Related Quiz
- In C, the ________ function is used to copy a specified number of characters from one string to another.
- Which sorting algorithm is most efficient when dealing with small datasets or partially sorted data?
- When dealing with an array of structures in C, what does each element of the array represent?
- In the context of bit fields, if the declared width is larger than the width of the specified type, the behavior is considered ________.
- How can you specify the starting value of an enumeration in C?