# What is the purpose of a “carry in”?

I'm currently trying to learn how binary adders work, but I don't understand what a "carry in" is for. What is the purpose of a "carry in"?

It's important to understand there's a difference between a half-adder and a full-adder.

A half-adder is the simplest. It has 2 inputs and 2 outputs. It's basically a XOR.

The primary output is only 1 if one of both inputs is 1, but not if both are 1. That's Sum. The second output is only 1 if both inputs are 1. That's Carry.

That's nice, but only if you're adding two bits. If you need more bits, you'll have to combine some adders together. Here's where full-adders come into play. The Least Significant Adder is a half-adder, and every More Significant Adder will be a full-adder which will take the Carry of the previous adder.

A   B   Cin     Cout    Sum
0   0   0       0       0
1   0   0       0       1
0   1   0       0       1
1   1   0       1       0
0   0   1       0       1
1   0   1       1       0
0   1   1       1       0
1   1   1       1       1


(shamelessly copied from Wikipedia)

If Carry in is 0, the behaviour of a full-adder is identical to a half-adder.

However, if Carry in is 1, the behaviour of Sum is inversed and the behaviour of Carry out changes into a OR. As long as any of the inputs is 1, Carry out is 1.

Carry in is required to turn a basic 2-bit adder into a multiple-bit counter. That's the purpose of Carry in.

• With twos complement format (-x == ~x + 1), the carry-in can also be used for subtraction (inverting the subtrahend and setting the carry-in negates the value which can then be added). – Paul A. Clayton Jul 24 '15 at 0:21