Home » C Programming » Variables » Question
  1. What will be the output of the following C code?
    #include <stdio.h>
    void main()
    {
    static double s;
    int s;
    printf("s is %d", s);
    }
    1. s is 0
    2. Compilation Error
    3. Runtime Error
    4. Garbage value
    5. None of these
Correct Option: B

Compilation Error

main.c: In function ‘main’:
main.c:5:13: error: conflicting types for ‘s’
int s;
^
main.c:4:23: note: previous declaration of ‘s’ was here
static double s;



Your comments will be displayed only after manual approval.