How to convert decimal to binary and vice versa in C? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to convert decimal to binary and vice versa in C?

9th Feb 2018, 11:43 AM
Aditya
Aditya - avatar
3 Answers
+ 2
Here's an example how you may do it. It's in C++, but you may port it to C easily, basically by replacing cin/cout with scanf/printf and string with char*: https://code.sololearn.com/ckOvFCBbB4o1/?ref=app
9th Feb 2018, 2:25 PM
deFault
+ 1
try to use itoa() and atoi, atoi(Number in string format) = Number int, itoa(Number, string container, numeric base)
15th Feb 2018, 9:08 AM
Pegasum
Pegasum - avatar
0
There is already a Solution released on Stack Overflow. The Solution works with BOOST_BINARY and itoa. My Opinion. Use Hex P.S.: Es gibt bereits eine Lösung für eine ähnliche Fragestellung bei StackOverflow. Es wurde mit BOOST_BINARY und itoa gelöst. Ansonsten. Meine Empfehlung. Benutz Hex. Ist nur eine komprimierte Form vom Binären
9th Feb 2018, 12:24 PM
I. Stark
I. Stark - avatar