Replace || by && and then j and k will get evaluated. The thing is that i think when the compiler sees a || operator ,if the first operand is true than it wont check for the second.Thus j and k are not getting evaluated.
On Tue, Jul 26, 2011 at 2:46 PM, Ankur Khurana <[email protected]>wrote: > #include<iostream> > > #include<string.h> > using namespace std; > #define N(e) "e"#e > > int main() > { > int i=1,j=2,k=3; > int m = i++ || j++ && k++; > cout<<i<<" "<<j<<" "<<k<<" "<<m; > } > > output :-2 2 3 1 > > http://www.ideone.com/0sKBr > > can anybody explain ? why are ++j and ++k are not evaluating even though && > operator should be evaluated first in order of evaluation. > > Regards, > Ankur > > -- > 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. > -- Regards Rajeev N B <http://www.opensourcemania.co.cc> -- 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.
