Home » C Programming » Strings » Question
  1. What will be the output of the following C code?
    #include <stdio.h>
    #include <string.h>
    int main()
    {
    char *s = "hello, Interview, Mania";
    char s1[25];
    strncpy(s1, s, 25);
    printf("%s %d", s1, strlen(s1));
    }
    1. Segmentation fault
    2. Compilation Error
    3. Nothing
    4. hello, Interview, Mania 23
    5. None of these
Correct Option: D

hello, Interview, Mania 23



Your comments will be displayed only after manual approval.