@Shauib: cool soln. Thank you. On Mon, Oct 3, 2011 at 6:14 PM, Shuaib <[email protected]> wrote:
> Chk is a macro that gets replaced with an if statement. The else part gets > attached to the most recent if which is the one from the macro. And since > the condition in macro fails, the else clause is executed. > > -- > Shuaib > http://twitter.com/ShuaibKhan > http://www.bytehood.com/ > > On 03-Oct-2011, at 4:47 PM, "~*~VICKY~*~" <[email protected]> wrote: > > #include<stdio.h> > #define chk(cond) if(!(cond))\ > fprintf(stderr,"chk failed: %s,file %s, line %d \n", #cond,\ > __FILE__,__LINE__),abort() > main() > { > int i = 0; > if(i==0) > chk(i < 100); > else > printf("hello"); > printf(" world"); > } > > output: hello world > > can anyone clearly explain how this works. > > > -- > Cheers, > > Vicky > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- Cheers, Vicky -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
