Tag Archives: binary

Swap variables without temporaries (XOR swap)

Swapping variables has always been a bit of an annoyance while programming. It doesn’t matter whether you code in C, Java, MIPS, or any other language, you’ve really only had one way to swap variables.

Posted in Programming, Random | Tagged , , , , | Leave a comment

All About Binary

This post contains information on how to convert decimal numbers to binary, 1′s complement, 2′s complement, and binary coded decimal. I’ve tried breaking it up to keep it somewhat organized, so hopefully you can follow.

Posted in Programming, Random | Tagged , , , , , | 2 Comments

Convert Decimal to 2′s Complement Binary in C

I was writing a program recently, and I needed a function that would convert a given decimal number to 2′s Complement (signed) binary. It’s simple enough to convert an unsigned integer to binary, but the sign (especially 2′s comp) makes … Continue reading

Posted in Programming | Tagged , | 8 Comments