Which function is used to compare two strings lexicographically in C++?compare()equals()strcmp()strcomp()
Question
Which function is used to compare two strings lexicographically in C++?compare()equals()strcmp()strcomp()
Solution
The function used to compare two strings lexicographically in C++ is strcmp().
Similar Questions
What is the function to compare two strings lexicographically in C programming?
Which of the library function is managed to compare two strings ?a.strlenb.strcatc.strcmpd.strcpy
What does the strcmp() function return when both the strings are equal?
Write a C program to compare two strings character by character.Read the string using character pointer.Pass the character pointer to a function "compare" and print equal/not equal.Sample InputcatCatSample Outputnot equal
#include <stdio.h> int main() { char *str = "hello, world"; char *str1 = "hello, world"; if (strcmp(str, str1)) printf("equal"); else printf("unequal"); } equalunequalCompilation error Depends on the compiler
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.