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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
09/10/07 07:16
Read: times


 
Msg Score: +1
 +1 Informative
#144235 - [OT] Leading zeros on numbers in C
Responding to: ???'s previous message
Andy Neil said:
Note that this applies specifically to Assembler - 'C' is different (and 'C' has a different meaning for numbers beginning with a leading zero...)

Jan Waclawek said:
Although this is not really relevant to the original post, can you please say it out aloud, WHAT is this meaning

Sure, I didn't want to further confuse the issue as this is 'C'-specific.

Anyhow, in 'C', a leading zero indicates that the number is in Octal notation.

For example, in 'C', the following are all entirely equivalent:
   unsigned char byte_value;

   byte_value = 0x32; // Hexadecimal
   byte_value =   50; // Decimal
   byte_value =  062; // Octal
   byte_value =  '2'; // Character
See: http://www.8052.com/forum/read.phtml?id=143587

Again, other languages will differ, and all assemblers may differ - so it is importand to check the specific manual.


List of 13 messages in thread
TopicAuthorDate
Assemble code            01/01/70 00:00      
   Have a look at the listing file            01/01/70 00:00      
   hex number begin with 0 -> #0AAH            01/01/70 00:00      
      explanation            01/01/70 00:00      
         RTFM!            01/01/70 00:00      
            please say out aloud            01/01/70 00:00      
               [OT] Leading zeros on numbers in C            01/01/70 00:00      
   reply            01/01/70 00:00      
      Yes            01/01/70 00:00      
         Explanation            01/01/70 00:00      
      asked and answered            01/01/70 00:00      
         Only for him            01/01/70 00:00      
   thanks            01/01/70 00:00      

Back to Subject List