Home / C Programming / Declarations and Initializations :: Discussion

Discussion :: Declarations and Initializations

  1. What will be the output of the program?

    #include 
      int X=40;
      int main()
     {
         int X=20;  
         printf("%d\n", X);   
         return 0; 
    } 
    

  2. A.

    20

    B.

    40

    C.

    Error

    D.

    No Output

    View Answer

    Workspace

    Answer : Option A

    Explanation :

    Whenever there is conflict between a local variable and global variable, the local variable gets priority.


Be The First To Comment