0

unsigned long long data type have max range up to 18446744073709551615

unsigned long long ll = 18446744073709551615;

how to create integer data type to save more than 10^18 value?

  • With a 128-bit integer (if available) or a big integer library. Related is [Is there a 128 bit integer in gcc?](https://stackoverflow.com/questions/16088282/is-there-a-128-bit-integer-in-gcc) – Weather Vane Jan 19 '21 at 13:24
  • Time for "bignums". Know the limits of your integer types. – tadman Jan 19 '21 at 13:27
  • If you are working on some online judge problem or other automatically graded problem, the problem is probably intended not to be solved with big integers but with thought and analysis that figures out a way to avoid them. – Eric Postpischil Jan 19 '21 at 13:27
  • You would first need enough memory to handle 4 quintillion bytes, and addressing capability to reference them all. – ryyker Jan 19 '21 at 13:31
  • See [here](https://stackoverflow.com/questions/3340511/what-is-the-simplest-way-of-implementing-bigint-in-c) and [here](https://stackoverflow.com/questions/565150/biginteger-in-c). – Steve Summit Jan 19 '21 at 15:54

0 Answers0