Decimal, Hex, and Binary 
Author Message
 Decimal, Hex, and Binary

Is there a built in function of C to convert between decimal, binary,
and Hex?
If so, what are they, and how can they be used in printf()?
If not, is there a short user function that I could use?

David Illsley
---
I think therefore iMac
Steve Jobs - Egomainiac



Wed, 07 Mar 2001 03:00:00 GMT  
 Decimal, Hex, and Binary

   Is there a built in function of C to convert between decimal, binary,
   and Hex?
   If so, what are they, and how can they be used in printf()?
   If not, is there a short user function that I could use?

Read the FAQ!  Do a newsgroup search!  This question gets asked
several time a week.
--
(supporter of the campaign for grumpiness where grumpiness is due in c.l.c)

Please: do not email me copies of your posts to comp.lang.c
        do not ask me C questions via email; post them instead



Wed, 07 Mar 2001 03:00:00 GMT  
 Decimal, Hex, and Binary

Quote:

> Is there a built in function of C to convert between decimal, binary,
> and Hex?
> If so, what are they, and how can they be used in printf()?
> If not, is there a short user function that I could use?

They are all just different ways of reffering to the same value.
The number is actually kept in memory in binary format.  You can assign
or reffer to it in any of decimal, hexidecimal, or octal (hex being the
easiest if your want particular binary format).  printf() actually has
ways of printing hex, decimal, and octal,...but not binary.  You have to
design a way to get the binary representation in a string and then print
it.


Wed, 07 Mar 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Convert from binary to decimal, hex to decimal etc

2. decimal to binary, hex, octal?

3. Hex to Decimal or Binary and Vice Versa

4. Hex to Binary => Binary to Hex

5. Large Decimal to Hex Conversion in C

6. converting hex to decimal

7. ASCII, Hex, decimal, and octal conversion

8. Calculating the decimal equivalent of a given hex value

9. How to convert Decimal to Hex?

10. How to convert Decimal to Hex?

11. decimal to hex..

12. Q:Hex to Decimal?

 

 
Powered by phpBB® Forum Software