Wednesday, 10 December 2014

Programming Quiz-6

Q: What is the output of this C code?

#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