Assuming that the underlying floating point arithmetic conforms to the IEEE Floating Point Standard, declare i to be a float or a double, and in the first case, initialize it to a NaN (Not a Number), and in the second case, initialize it to an Inf (Infinity).
According to the IEEE standard, NaN == NaN tests false, and Inf + 1 == Inf tests true. Please check the help system or man pages with your compiler for more information on Inf and NaN. Dave On Aug 31, 3:44 pm, fanatic <[email protected]> wrote: > //initialize i in the two cases below so that the programs go in > infinite loops > > first program: > main() > { > //initialize i > > while(i!=i); > > } > > second program: > > main() > { > > //initialize i > > while(i==i+1); > > > > }- Hide quoted text - > > - Show quoted text - -- 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.
