[Updated] Goldman Sachs Aptitude Test Questions and Answers
Practice List of TCS Digital Coding Questions !!!
Take 50+ FREE!! Online Data Interpretation Mock test to crack any Exams.

C Programming :: String - Discussion

Home > C Programming > String > MCQs Questions Discussion

11 / 26

What is the output of the following 'C' program ?

#include<stdio.h>
void main()
{
char str1[] = "Hello";
char str2[] = "Hello";
if (str1 == str2)
printf("\nequal");
else
printf("\nUnequal");
}

AEqual

BError

CUnequal

DNone of these

Answer: Option (Login/Signup)

Show Explanation

The '==' operator is meant for reference comparison i.e, it returns true only if the 2 string objects are same, else it will return false. Here, since the 2 string objects are different, the else part gets executed, and the output is Unequal, i.e, option C. 


Asked In ::

Post Your Answer Here:     

Reply    
Rate This: +0 -0
    Report


Report Error

Please Login First Click Here