Binary addition are also performed like decimal addition, the rules are same. Since in binary we have got only two symbols, the carry is generated very frequently, and some times this is really irritating.
Lets try to add 1100 which is (12)10, and 0111 which is (7)10.
carry -> 1 val_1 -> 1 1 0 0 val_2 -> + 0 1 1 1 ----------------------- sum -> 1 0 0 1 1 -----------------------
Addition of 12 and 7 is 19 which is more than 15 and cannot fit into 4 bits, hence the result(sum) is 5 bits.
The table below shows what value of sum and carry will be generated for every possible combination of val_1, val_2 and carry.
carry val_1 val_2 sum carry(generated) 1) 0 + 0 + 0 = 0 -> 0 2) 0 + 0 + 1 = 1 -> 0 3) 0 + 1 + 0 = 1 -> 0 4) 0 + 1 + 1 = 0 -> 1 5) 1 + 0 + 0 = 1 -> 0 6) 1 + 0 + 1 = 0 -> 1 7) 1 + 1 + 0 = 0 -> 1 8) 1 + 1 + 1 = 1 -> 1
For example, you can see that at line no 1; for carry=0, val_1=0, and val_2=0 the result sum will be 0, and carry generated will be 0.
Similarly, at line 4; for carry=0, val_1=1, and val_2=1 the result sum will be 0, and carry generated will be 1.
Since above table provides result for all (carry, val_1 and val_2) combinations, it can be used for any binary addition.