Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
09/06/06 15:55
Read: times


 
#123762 - Uninitialised?
Responding to: ???'s previous message
Jon Ledbetter said:
temp = temp * 10 + key;

For this to work, you need to ensure that temp is set to zero at the start of your function.

You didn't show the initialisation; if it's really not there, the behaviour becomes pretty much undefined.

The thing with "undefined" behaviour is that it can sometimes look like "correct" behaviour - so it might be just pure luck that gives you the "right" answer when you define it as 'char' rather than 'int'...

List of 16 messages in thread
TopicAuthorDate
A learning 'C' speed bump            01/01/70 00:00      
   Uninitialised?            01/01/70 00:00      
      Variables were initialized.            01/01/70 00:00      
         logical vs bitwise            01/01/70 00:00      
            this is when the C people try to be smart...            01/01/70 00:00      
            Ok, corrected the && ...            01/01/70 00:00      
               check the size of the variables            01/01/70 00:00      
                  I Ceed it already            01/01/70 00:00      
   Style            01/01/70 00:00      
      style does not apply to C only            01/01/70 00:00      
         words            01/01/70 00:00      
   Does it??            01/01/70 00:00      
      Verification            01/01/70 00:00      
   oh come on...            01/01/70 00:00      
   RESOLVED            01/01/70 00:00      
   variable scope            01/01/70 00:00      

Back to Subject List