Hello guys!

I've wrote a function that takes two numbers and "Connects" them together. Example:

12345, 98766 >>>>> 1234598766.

Here it is:

Code:

unsigned long long concatenate(unsigned long long x, unsigned long long y) // Checked, works ok!!!
{
int counter=0, test, tens=1;
test=y;
while (test>0)
{
counter++;
test/=10;
}
while (counter>0)
{
tens*=10;
counter--;
}
x= (x* tens ) + y;
return x;
}

Now, it works well, except when I try to do it for TWO long numbers....

Example:

if I try to connect:

6611 and 93311267 I get 406333314979.

It's weird because the function itself works, and this new numbers does have 12 digits as it should have, but they're different....

I'd like to know if it's something with the variables perhaps?

Thanks a bunch!