I am trying to recieve a large number from the user and doing some manipulation on it.
The number is 15 digit long. I tried to save as an int but it's too small.
I also tried to save as a long int, unsigned int and it's still to small.
Do you have any suggestions what can I do?
Thanks.
Well, I'm not familiair with datatypes in C, but you could use the solution jpeg suggested. I know you cant use strings, but an array of chars would work. After you got the input, you can convert it to an array of integers and create functions to perform the required operations.
I bed there is an easier solution, but I dont know it :)
1. unsigned long long int
2. Store it as a string
3. Store it as BCD
4. Store it as a bignum
Option two means you have to add/subtract/multiply/etc strings.
Option three is really just a much more convenient variation of option two.
Option four is what I suggest. You can either roll your own, or just go straight to the GNU MP Bignum Library. http://gmplib.org/