Declarations and Initializations - Programming

Q1:

What will be the output of the program?
#include<stdio.h>
int main()
{
    int X=40;
    {
        int X=20;
        printf('%d ', X);
    }
    printf('%d\n', X);
    return 0;
}

A 40 40

B 20 40

C 20

D Error

ANS:A - 40 40

In case of a conflict between a local variable and global variable, the local variable gets priority.