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

Compilation Error

main.c: In function ‘main’:
main.c:7:22: error: ‘R’ undeclared (first use in this function)
printf("%d", R);
^
main.c:7:22: note: each undeclared identifier is reported only once for each function it appears in



Your comments will be displayed only after manual approval.