Home » C Programming » Input & Output » Question
  1. What will be the output of the following C code?
    #include <stdio.h>
    #include <string.h>
    int main()
    {
    char line[];
    fgets(line, 25, stdin);
    printf("%d\n", strlen(line));
    return 0;
    }
    1. 25
    2. Any length since line did not end with null character
    3. Compilation Error
    4. Runtime Error
    5. None of these
Correct Option: C

Compilation Error

main.c: In function ‘main’:
main.c:5:14: error: array size missing in ‘line’
char line[];



Your comments will be displayed only after manual approval.