In this program, we will create four string variables and compare them using casecmp?() and print the appropriate message. The casecmp?() method is used to compare two strings by ignoring the case. It returns 0 if both strings are equal otherwise it returns a non-zero value.
Program/Source Code:
The source code to compare two strings by ignoring the case is given below. The given program is compiled and executed successfully.
Output:
Explanation:
In the above program, we created 4 variables Str1, Str2, Str3, Str4 that are initialized with "Hello", "hello", "Hello", "Hi". Then we compared string variables using the casecmp?() method and printed the appropriate message.
need an explanation for this answer? contact us directly to get an explanation for this answer