User Defined long long int in CPP

How we can able to create User defined long long int for large numbers in CPP.??

For large number in c++ which go beyond the long long u have to manipulate as string and then for algebraic operation u can write basic function for addition , subtraction…and so on.

depends on how large the number is, use uint64_t, it can handle numbers upto 2^64.

To create long long int you do this:

long long var; //var can hold up to 2^63-1 ("long long" or "long long int" is the same thing)

To go beyond this limit you can use libraries like boost, or make your own.

If you use python or java, you can do it without any external libraries.

shouldn’t it be unsigned long long to hold upto 2^64

1 Like

Correct, I’ve edited it.

How we can able to create User-defined long long int for large numbers in CPP.??
well, you can use this big-int class this has pretty much all the important algebraic functions you need with a number.
[https://github.com/amit-nits/justforsharing/blob/master/classbigint.cpp](http://class big int)
This is literally user defined big-int datatype.