CameraIcon
CameraIcon
SearchIcon
MyQuestionIcon
MyQuestionIcon
1
You visited us 1 times! Enjoying our articles? Unlock Full Access!
Question

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.

flag
Suggest Corrections
thumbs-up
0
Join BYJU'S Learning Program
similar_icon
Related Videos
thumbnail
lock
Liquids in Liquids and Raoult's Law
CHEMISTRY
Watch in App
Join BYJU'S Learning Program
CrossIcon