Quantcast
Channel: Unsigned 32-bit integer to binary string function - Code Review Stack Exchange
Browsing latest articles
Browse All 5 View Live

Answer by Abstract Approach for Unsigned 32-bit integer to binary string...

Computers convert decimal to binary anytime people code. As such, computers probably have a very fast way to do it. Ben Eater, on YouTube, has a video about hardwiring a decimal to hex converter with...

View Article


Answer by Lundin for Unsigned 32-bit integer to binary string function

As already said in other reviews, you should switch to caller allocation. And there's no initialize the string at all, just overwrite all of it.As for the algorithm itself, or in general, go with...

View Article


Answer by Toby Speight for Unsigned 32-bit integer to binary string function

The interface is problematic. What output does this code produce?#include <stdio.h>int main(void){ const char *s1 = uint32_to_binarystr(0); const char *s2 = uint32_to_binarystr(1000000);...

View Article

Answer by AJNeufeld for Unsigned 32-bit integer to binary string function

Your code has a possible bug, depending on your CPU/compiler.You are treating UINT32_MAX (0xFFFFFFFF) as a special case, however, you could run into problems with any value greater that 0x80000000.For...

View Article

Unsigned 32-bit integer to binary string function

I've been trying to solidify my understanding of the binary number system by writing code. So, I tried to write a function with what I currently understand about the binary system that returns a string...

View Article

Browsing latest articles
Browse All 5 View Live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>