Correct way to find if contents of two strings are equal ?
A. if (s1 = s2)
B. if (s1 != s2)
C. if (strcmp (s1 ,s2))
D. if ( s1 is s2)
Answer:C
Correct way to find if contents of two strings are equal ?
A. if (s1 = s2) B. if (s1 != s2) C. if (strcmp (s1 ,s2)) D. if ( s1 is s2)
Explanation: “==” operator used to compare length of two strings and strcmp() is the inbuilt method derived from string class.