Answer the question
In order to leave comments, you need to log in
Is it possible to resize an int type?
Here is the usual size of the int type - 32 bits. Is it possible to do 31 or 33? Just wondering.
Answer the question
In order to leave comments, you need to log in
1. The size of all types is always a multiple of 8 bits. Simply because the minimum addressable memory size in modern processors is 1 byte. So 31 or 33 is not possible. Theoretically, you can do, for example, 24 or 40, but see the next paragraph.
2. All basic C/C++ types are uniquely projected onto data types supported by the processor. Therefore, it is realistic to use only types that are supported by iron. And there are not so many of them, and all of them, most likely, already exist among the basic types of C / C ++.
Yes, you can use the option with bit fields or libraries for long numbers, etc., but the calculations in this case will be slow, because All operations will have to be implemented programmatically. In addition, if we take bit fields, you can define a field of 31 bits there, but the variable will still occupy 32 bits in memory (see paragraph 1).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question