Ok, I have been working on a project lately that required me to write a function that added together strings of numbers. Such as "123" + "321" = "444". It all needs to stay as a string. I wrote the function, and it works up until a certain point and I can't figure out what is wrong with it. The first while loop works perfectly, but then the second screws up and it's almost exactly the same as the first. Here is the code and the functions it itself uses. Why does it not work? or if you have a better function written, what is it?
Code:
#include <string.h>
#include <iostream.h>

void cstradd(char *fnum, char *snum, char *lnum);
void cstrrev(char *str);

int  main()
{
	char a[12] = "2242442245"; //"12345678910";
	char b[11] = "242"; //"1112131415";
	char c[] = "";
	cstradd(a,b,c);
	cout << a << " + " << b << " = " << c << endl;
	return 0;
}

void cstradd(char fnum[], char snum[], char lnum[])
{
	cstrrev(fnum);
	cstrrev(snum);
	int count = 0;
	char carry = 0;
	while(fnum[count] != 0 && snum[count] != 0)
	{
		char temp[2] = "0";
		temp[0] = (fnum[count] - 48) + (snum[count] - 48) + carry;
		carry = 0;
		if(temp[0] > 9)
		{
			temp[0] = temp[0] + 38;
			carry = 1;
		}
		else
		{
			temp[0] = temp[0] + 48;
		}
		strcat(lnum, temp);
		temp[0] = 0;
		count++;
	}
	/* This is the while loop that fails, some how it is editing snum and just totally screws up, it's just like the first while loop but with only fnum, I don't know what is screwing up */
        while(fnum[count] != 0) 
	{
		char temp[2] = "0";
		temp[0] = (fnum[count] - 48) + carry;
		carry = 0;
		if(temp[0] > 9)
		{
			temp[0] = temp[0] + 38;
			carry = 1;
		}
		else
		{
			temp[0] = temp[0] + 48;
		}
		strcat(lnum, temp);
		temp[0] = 0;
		count++;
	}
	while(snum[count] != 0)
	{
		char temp[2] = "0";
		temp [0] = (snum[count] - 48) + carry;
		carry = 0;
		if(temp[0] > 9)
		{
			temp[0] = temp[0] + 38;
			carry = 1;
		}
		else
		{
			temp[0] = temp[0] + 48;
		}
		strcat(lnum, temp);
		temp[0] = 0;
		count++;
	}
	if(carry == 1)
	{
		char temp[2] = "1";
		strcat(lnum, temp);
	}
	cstrrev(lnum);
	cstrrev(fnum);
	cstrrev(snum);
}

void cstrrev(char str[])   // This works for reversing a string
{
	int l=strlen(str)-1;
	for(int x=0;x<l;x++,l--)
	{
		str[x]^=str[l];  //triple XOR Trick
		str[l]^=str[x];  //for not using a temp
		str[x]^=str[l];
	}
}