View Single Post
Old May 5th, 2007, 10:17 AM   #4
grumpy
Programming Guru
 
grumpy's Avatar
 
Join Date: Jun 2005
Location: Adelaide, South Australia
Posts: 1,223
Rep Power: 5 grumpy is on a distinguished road
Quote:
Originally Posted by ZenOswyn View Post
    char ch;
   
    while(!ch || ch != 'x') {
Technically, the above yields undefined behaviour (reading the value of an uninitialised variable yields undefined behaviour). To avoid that, initialise ch to zero (or to some value not equal to 'x') before the loop.
grumpy is offline   Reply With Quote