0

I was thinking about how someone would implement some sort of program that has to deal with very large numbers in C. If somebody were to attempt this, how would they store the number in memory? Would it be possible to have a long *ptr that points to a block of memory, and the addition of the values stored in that allocated memory every 8 bytes could contain the entire value? If there is some other more efficient approach, please explain, thanks!

neutron02
  • 47
  • 9
  • Yes, that. [This kind of very large?](https://stackoverflow.com/questions/565150/biginteger-in-c) – Ry- Jul 19 '22 at 23:11
  • 1
    How do you record a number larger than 9 using only digits from 0 to 9? – Eric Postpischil Jul 19 '22 at 23:11
  • This is common place, there are something like `BigNum` implementations in every language to work with arbitrarily large numbers. We have been doing this since the earliest days of computing, when storing any kind of useful number typically couldn't happen in a single [word](https://en.wikipedia.org/wiki/Word_(computer_architecture)). – user229044 Jul 19 '22 at 23:11
  • You can see some example code at [this question](https://stackoverflow.com/questions/66109785) and [this question](https://stackoverflow.com/questions/72013383). – Steve Summit Jul 19 '22 at 23:15

0 Answers0