Tuesday, September 04, 2007

Trivias

Have a look at following c++ code

a=3;
b=2;
if((a+b)!=5)
{
// code
}


What would be the precondition that would make the "if" condition true and block of code inside will get executed ?

Simple, let a and be UDT and overload operators !!!

Want another ??? okay check out following code.

if( (a+1) <= a )

{
// code

}


Under what condition would above "if" condition be true ?? Not difficult at all, simply set value of 'a' as max of that datatype. The above code would get executed during OverFlow condition.

Interested in more such Trivias ???? Head over to www.mstechexperts.org ( MS Tech Experts ) ....