i think it will take a garbage value for i because these are
preprocessor directives.

On Jun 30, 4:46 pm, himanshu kansal <himanshukansal...@gmail.com>
wrote:
> 1 more thng....if its possible to eval. variable expression lyk abv...
> thn...
> int i=2;
> #if i==2
> printf("hi");
> #else
> printf(""bye);     //prints bye....i think it shld print hi...
> #endif
>
> even this code prints bye.....
>
> int i=3;
> #if i==2
> printf("hi");
> #else
> printf(""bye);
> #endif
>
> On Thu, Jun 30, 2011 at 5:13 PM, himanshu kansal <
>
>
>
>
>
>
>
>
>
> himanshukansal...@gmail.com> wrote:
> > somewhere i read dt conditional compilation such as #if and #elif etc
> > cn only use constant expressions and previously defined macros....they
> > cant use variables cz preprocessng is done b4 compilation...
> > bt whn i try it on gcc and vc both r compiling it with variables abs.
> > fyn....even disabling extensions dint work....
> > i.e int i;
> > #if i+1
> > printf("hi");     vl print hi...no error occurs
> > #endif
>
> > thn i read it on net dt it cn eval. varables also....
> > nw m confused who is ryt...
> > whtr it cn eval var also or nt...
> > nd if it cn thn hws it possible dt preprocessor knows d val. of var.
> > b4 compiling d prog.......
>
> --
>
>       Regards
> Himanshu Kansal
>   Msc Comp. sc.
> (University of Delhi)

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to