Top

Discussion

What will be the output of the following C code?

#include 
    #include 
    int main()
    {
        char *str = "hello, world";
        char str1[9];
        strncpy(str1, str, 9);
        printf("%s %d", str1, strlen(str1));
    }

 

  • A.hello, world 11
  • B.hello, wor 9
  • C.Undefined behaviour
  • D.Compilation error

Answer: C

No answer description available for this question.
 

No comment is present. Be the first to comment.
Loading…

Post your comment