What is the ouput of the following program?
main ( )
{
char str1[ ] = "Hello";
char str1[ ] = "Hello";
if(str1 = = str2 && (*(str 1+6) = = *(str2+6)))
printf("\n equal");
else
printf("\n unequal");
}
A
hello
No worries! We‘ve got your back. Try BYJU‘S free classes today!
B
equal
No worries! We‘ve got your back. Try BYJU‘S free classes today!
C
unequal
Right on! Give the BNAT exam to get a 100% scholarship for BYJUS courses
D
none of these
No worries! We‘ve got your back. Try BYJU‘S free classes today!
Open in App
Solution
The correct option is C unequal The condition under if is str1 = = str2. This condition is FALSE as no two character array's have same base address. So the else part will be executed is unequal, So the output is unequal.