0

how should i compare two strings in c/c++

till now i have using == operators. but there are several methods like strcmp(),etc. what should i use

15th Jan 2018, 5:27 AM
shobhit
shobhit - avatar
4 Answers
+ 20
By using "strcmp" function. It is available in the library string.h
15th Jan 2018, 5:48 AM
Abhivarshini Maddala
Abhivarshini Maddala - avatar
+ 1
use strcmp to compare string if both string equal then it will return zero. For c include string.h and for c++ include cstring.h header file.
15th Jan 2018, 6:47 AM
jitendra maurya
jitendra maurya - avatar