Certainly Aman. The concepts of pre and post increment still stand correct.
while (x = --x) will terminate after x = 1 and when encountered (x = --x) => x = 0 (after testing condition). Thus, 0 will not be printed. while (x = x--) will terminate after x = 0 and when encountered (x = x--) => x= -1 (after testing condition). Thus, 0 will be printed. I hope this answer is acceptable :) On 21 July 2011 19:44, Aman Goyal <[email protected]> wrote: > My mistake, i forgot to initiate x. > > Sorry for the mistake. But for devc it is infinite, then should we ignore > that? > > > On Thu, Jul 21, 2011 at 7:40 PM, poised <[email protected]> wrote: > >> Both the codes work perfectly on Ubuntu 11.04. (gcc) >> >> first code gives 0 in output. >> second one doesn't give 0 in output. >> >> both work as intended. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To view this discussion on the web visit >> https://groups.google.com/d/msg/algogeeks/-/yPBntEpz6gIJ. >> >> 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. > -- ___________________________________________________________________________________________________________ Please do not print this e-mail until urgent requirement. Go Green!! Save Papers <=> Save Trees -- 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.
