Vidyalelo
C Programming · Q208

File Input Output

Programming · C Programming · question 208

Q208

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
Answer
D.
Compilation error

Answer: Option C

Solution

Answer: Option C
No explanation is given for this question Let's Discuss on Board