Skip to main content

Posts

Showing posts from 2017

Tricky Question in C

Q. What will be output if you execute the following c code? void   main (){    int  i=10;    static   int  value=i;    if (value==i)       printf( "Both are Equal" );    else   if (x>i)       printf( "value is Greater than i" );    else       printf( "value is Less than i" ); } (a)  Both are Equal (b)  value is Greater than i (c)  value is Less than i (d) Compiler error (e) None of above Ans:   (d) Explanation: As we know that static variables are load time entity while auto variables are run time entity. Son it is not possible to initialize any load time variable by the run time variable. In the above example i is a run time variable while x is load time variable.