you are using post increment which increments th evariable in next line :) (except for the case of printf();
so here z=x++ + x++ will give you z=3+3 and the two post increment will give you x+=2 i hope toy get it ) On Tue, Jul 19, 2011 at 8:17 AM, Vengadanathan <[email protected]>wrote: > this is the program , > #include<stdio.h> > int main() > { > int z=0,x=3; > z = x++ + x++; > printf("%d %d",z,x); > return 0; > } > > i though the output would be 7,5 , but when i ran the code it was > 6,5 , can anyone tell me how this o/p is obtained . > thanx in advance > > -- > 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 SAGAR PAREEK COMPUTER SCIENCE AND ENGINEERING NIT ALLAHABAD -- 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.
