I am currently working on a program that will perform binary addition on two or more arguments from the command line. My problem comes when I want it to print to standard out. I am getting some strange output that I cannot figure out. Looks like as follows.
00
01
Any advice on what this is and how I can get around it would be appreciated. Code is attached and broken into the two functions used.

Code:
int main(int argc, char *argv[])
//			IN		IN
{
	char partialSum[MAX_DIGITS + 1];   //partial sum of the binary numbers
	char sum[MAX_DIGITS + 1];		//sum of the binary numbers
	bool noError;		//no error flag
	
	//Exit if insufficient arguments passed to function
	if (argc < 3)
	{
		cout << "Insufficient arguments passed" << endl;
		return 1;
	}
	
	//Add the first two binary numbers on the command line.
	noError = Badd(argv[1], argv[2], sum);
	
	//Add additional binary numbers to the partial sum
	for (int counter = 3; noError && counter < argc; counter++)
	{
		strcpy(partialSum, sum);
		noError = Badd(partialSum, argv[counter], sum);
	}
	
	//Print the answer to standard output
	if (noError)
	{
		for (int counter = 0; counter < strlen(sum); counter++)
		{
			cout << sum[counter];
		}
		cout << endl;
	}
	else
		cout << 'E' << endl;
		
	return 0;
}// end main function
Code:
bool Badd(const char augend[], const char addend[], char sum[])
//			IN					IN					OUT
//PRE: augend and addend are strings representing valid binary numbers
//POST: sum is a string representing augend + addend
//returns true if addition is successful and false if otherwise
{
	char carry = '0';    //Carry after addition
	int lengthDif;   //Difference in string lengths
	//Length of the longer string
	int longStringLength;
	int stringLength;  //string length when strings are equal
	
	if (strcmp(augend, addend) == 0)
	{
		stringLength = strlen(augend);
	}
	else if (strcmp(augend, addend) < 0)
	{
		longStringLength = strlen(addend);
		lengthDif = strlen(addend) - strlen(augend);
	}
	
	else if(strcmp(augend, addend) > 0)
	{
		longStringLength = strlen(augend);
		lengthDif = strlen(augend) - strlen(addend);
	}
	
	if (longStringLength == strlen(augend))
	{
		for (int counter = longStringLength; counter < lengthDif; counter--)
		{
			if (carry == '0'  && augend[counter] == '0' && addend[counter - lengthDif] == '0')
			{
				sum[counter] = '0';
			}
			
			else if(carry == '1' && augend[counter] == '0' && addend[counter - lengthDif] == '0')
			{
				sum[counter] = '1';
			}
			
			else if(carry == '0' && augend[counter] == '1' && addend[counter - lengthDif] == '0')
			{
				sum[counter] = '1';
			}
			
			else if(carry == '0' && augend[counter] == '0' && addend[counter -lengthDif] == '1')
			{
				sum[counter] = '1';
			}
			else if(carry == '1' && augend[counter] == '1' && addend[counter - lengthDif] == '0')
			{
				sum[counter] = '0';
				carry = '1';
			}
			
			else if(carry == '0' && augend[counter] == '1' && addend[counter - lengthDif] == '1')
			{
				sum[counter] = '0';
				carry = '1';
			}
			
			else if(carry == '1' && augend[counter] == '0' && addend[counter - lengthDif] == '1')
			{
				sum[counter] = '0';
				carry = '1';
			}
			
			else if(carry == '1' && augend[counter] == '1' && addend[counter - lengthDif] == '1')
			{
				sum[counter] = '1';
				carry = '1';
			}
		}
		
		for (int counter = lengthDif - 1; counter < 0; counter--)
		{
			if (carry == '0' && augend[counter] == '0')
			{
				sum[counter] = '0';
			}
			
			else if(carry == '0' && augend[counter] == '1')
			{
				sum[counter] = '1';
			}
			
			else if (carry == '1' && augend[counter] == '0')
			{
				sum[counter] = '1';
			}
			
			else if (carry == '1' && augend[counter] == '1')
			{
				sum[counter] = '0';
				carry = '1';
			}
		}
	}
	
	if (longStringLength == strlen(addend))
	{
		for (int counter = longStringLength; counter < lengthDif; counter--)
		{
			if (carry == '0'  && augend[counter - lengthDif] == '0' && addend[counter] == '0')
			{
				sum[counter] = '0';
			}
			
			else if(carry == '1' && augend[counter - lengthDif] == '0' && addend[counter] == '0')
			{
				sum[counter] = '1';
			}
			
			else if(carry == '0' && augend[counter - lengthDif] == '1' && addend[counter] == '0')
			{
				sum[counter] = '1';
			}
			
			else if(carry == '0' && augend[counter - lengthDif] == '0' && addend[counter] == '1')
			{
				sum[counter] = '1';
			}
			else if(carry == '1' && augend[counter - lengthDif] == '1' && addend[counter] == '0')
			{
				sum[counter] = '0';
				carry = '1';
			}
			
			else if(carry == '0' && augend[counter - lengthDif] == '1' && addend[counter] == '1')
			{
				sum[counter] = '0';
				carry = '1';
			}
			
			else if(carry == '1' && augend[counter - lengthDif] == '0' && addend[counter] == '1')
			{
				sum[counter] = '0';
				carry = '1';
			}
			
			else if(carry == '1' && augend[counter - lengthDif] == '1' && addend[counter] == '1')
			{
				sum[counter] = '1';
				carry = '1';
			}
		}
		
		for (int counter = lengthDif - 1; counter < 0; counter--)
		{
			if (carry == '0' && addend[counter] == '0')
			{
				sum[counter] = '0';
			}
			
			else if(carry == '0' && addend[counter] == '1')
			{
				sum[counter] = '1';
			}
			
			else if (carry == '1' && addend[counter] == '0')
			{
				sum[counter] = '1';
			}
			
			else if (carry == '1' && addend[counter] == '1')
			{
				sum[counter] = '0';
				carry = '1';
			}
		}
	}
	
	if (stringLength == strlen(augend))
	{
		for (int counter = stringLength; counter < 0; counter--)
		{
			if (carry == '0'  && augend[counter] == '0' && addend[counter] == '0')
			{
				sum[counter] = '0';
			}
			
			else if(carry == '1' && augend[counter] == '0' && addend[counter] == '0')
			{
				sum[counter] = '1';
			}
			
			else if(carry == '0' && augend[counter] == '1' && addend[counter] == '0')
			{
				sum[counter] = '1';
			}
			
			else if(carry == '0' && augend[counter] == '0' && addend[counter] == '1')
			{
				sum[counter] = '1';
			}
			else if(carry == '1' && augend[counter] == '1' && addend[counter] == '0')
			{
				sum[counter] = '0';
				carry = '1';
			}
			
			else if(carry == '0' && augend[counter] == '1' && addend[counter] == '1')
			{
				sum[counter] = '0';
				carry = '1';
			}
			
			else if(carry == '1' && augend[counter] == '0' && addend[counter] == '1')
			{
				sum[counter] = '0';
				carry = '1';
			}
			
			else if(carry == '1' && augend[counter] == '1' && addend[counter] == '1')
			{
				sum[counter] = '1';
				carry = '1';
			}
		}
	}
	sum[strlen(sum) + 1] = '\0';
	if (strlen(sum) > MAX_DIGITS)
		return false;
	
	else
		return true;
} //end of Badd function