Q: What is the output of this C code?
Options:
a) equal
b) unequal
c) Compilation error
d) Depends on the compiler
Answer: B
| #include <stdio.h> |
| #include<string.h> int main() |
| { |
| char *str = "hello, world" ; |
| char *str1 = "hello, world" ; |
| if ( strcmp (str, str1)) |
| printf ( "equal" ); |
| else |
| printf ( "unequal" ); |
| } |
Options:
a) equal
b) unequal
c) Compilation error
d) Depends on the compiler
Answer: B
No comments:
Post a Comment