?
What will be the output of the following program?
What will be the output of the following program?
void main()
{
char str1[] = "abcd";
char str2[] = "abcd";
if(str1==str2)
printf("Equal");
else
printf("Unequal");
}
void main()
{
char str1[] = "abcd";
char str2[] = "abcd";
if(str1==str2)
printf("Equal");
else
printf("Unequal");
}
Answer & Solution
Correct Answer:
Option
B
Strings are compared using strcmp() function defined under string.h header file.
Join the Discussion
Login to post a comment or share your explanation.
LoginString str2 = str1.toLowerCase();
str2.replace(‘a’ , ‘b’ );
str2.replace(‘b’ , ‘c’ );
System.out.printIn(str2);
if(str1==str2);// we will get if(0) i.e if(false)
so the else part is executed.
can u tell in simple...................