I have this program I have to write about adding binary numbers. Here is the write up:
"Defining a binary number as int binNum[8]; write a C++ function
void binaryAdd(int* sum, int& cBit, const int* bin1, const int* bin2)
to compute sum as the sum of the two binary numbers, bin1 and bin2. cBit should be the value of the carry bit after the addition. sum should be the result in binary. For example, if the two binary numbers are 01111111 and 00111111, then sum will be 10111110 and carry will be 0. Test your function with interactive input."
Now I know how to go about adding the binary numbers, and the carry bit part I can figure out. What I am having troube with is how the binaryAdd function is taking in the sum and cBit. I must be looking at this completely wrong because to me it looks like you pass the sum and cBit into the function, but I though that is what the function is suppose to produce. I am confused with pointers and references, I dont really understand why they are being used in this situation. Any help starting this off would be appreciated. Im so lost. Thanks.