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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
03/08/04 20:14
Read: times


 
#66290 - RE:printf
Responding to: ???'s previous message
Bartosz Wucke said:
It's up to you to watch the number of arguments, printf() won't do that for you.


Not only the number of arguments; also the type.

The commonest error when using printf in C51 - and one specifically addressed in the Manual section that I cited earlier - is to use a %d in the format string, but supply a char parameter:
The %d specifier requires an int value, which is 16 bits in C51; so you will obviously get rubbish if you give it a char - which is only 8 bits! This will leave the parameter-passing mechanism out-of-step, so all subsequent parameters are likely to also print as rubbish!

List of 17 messages in thread
TopicAuthorDate
An Error in Kiel            01/01/70 00:00      
   RE: An Error in Kiel            01/01/70 00:00      
   Keil            01/01/70 00:00      
   RE: An Error in Kiel            01/01/70 00:00      
      RE: An Error in Kiel            01/01/70 00:00      
         Some mysterious errors            01/01/70 00:00      
            RE: Some mysterious errors            01/01/70 00:00      
               RE: Some mysterious errors            01/01/70 00:00      
                  RE: addendum to the above            01/01/70 00:00      
            Not-so-mysterious errors            01/01/70 00:00      
               RE: Not-so-mysterious errors            01/01/70 00:00      
                  RE: Not-so-mysterious errors            01/01/70 00:00      
                     RE: Not-so-mysterious errors            01/01/70 00:00      
                        RE: Not-so-mysterious errors            01/01/70 00:00      
                           RE:printf            01/01/70 00:00      
   RE: An Error in Kiel            01/01/70 00:00      
      LX51: How will that help?            01/01/70 00:00      

Back to Subject List