+ 4
Are there any library that dynamically allocates memory for integers in c++ ?
I want integer types in c++ function like it's in Python. There is no limit. The size and range of ints are dynamic in Python. How can I achieve this in cpp.
7 Respuestas
+ 4
Yes, Ipang you guessed right
+ 4
I don't believe this is possible in C++ which is a statically typed language where when you declare an integer variable, a fixed number of bytes is allocated, depending on the architecture.
+ 3
I don't want an array of ints. I want an dynamic int type. With dynamic size and width.
+ 3
Terminal_Phantom
Bro, as I understand it, it was meant that way in the language. It was designed with small systems considerations. Bigger integers means more memory for each instance, I guess that wasn't the plan.
But maybe others can suggest you some ways into it, by means of library or something else. I'm sticking around to learn ...
+ 3
Here is a specific problem.
How can I store an int of size 32 bytes in cpp or more bytes as per my requirements ?
+ 2
Terminal_Phantom
Are you referring to the size and/or range width of the `int` type? as if whether C++ `int` can behave like Python `int`?
+ 1
Can we make library to achieve that in C