BeginnerLK
BeginnerLK

Reputation: 33

C++ Increase int size limit

Is there a way in C++ to increase the limit on integers? I want to work with a 13 digit number e.g. 4823423658586. The complier does not allow this.

Upvotes: 1

Views: 5597

Answers (1)

Don't stop forking
Don't stop forking

Reputation: 317

Since the largest 13 digit integer can be stored using 6 bytes you need a type which will store at least 6 bytes, that type is a long long which can hold 8 bytes.

So instead of

int x=100;

use

long long x=100;

Upvotes: 3

Related Questions