Vidyalelo
C Programming · Q40

Arrays and Strings

Programming · C Programming · question 40

Q40

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");

A.
Equal
B.
Unequal
Answer
C.
Error
D.
None of these.

Answer: Option B

Solution

Answer: Option B
Solution:

Strings are compared using strcmp() function defined under string.h header file.