For exemple this number : 35672825189..it's an intger ? Will be declared just int or long int ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

For exemple this number : 35672825189..it's an intger ? Will be declared just int or long int ?

25th Apr 2017, 10:02 PM
De Vinci
8 Answers
+ 20
The int storage type has many different versions that the compiler decides it to be at compile time when it's optimizing. This number if you split it up properly: 35,672,825,189 is larger than a long int. In fact it is the size of approximately 2 long integers (a long int is the size of 4 bytes or 2^32 bits.). Which means that we have 8 bytes. The compiler would most likely use dynamic memory and mark it as an Int64(2^64 bits) which is the largest it can be without going out of bounds.
25th Apr 2017, 10:58 PM
SoraKatadzuma
SoraKatadzuma - avatar
+ 3
yes, it's an integer and will be declared as long int or won't be possible to store it
25th Apr 2017, 10:20 PM
Welliton Malta
Welliton Malta - avatar
+ 3
not necessarely, you can do it without dynamic memory
25th Apr 2017, 10:36 PM
Welliton Malta
Welliton Malta - avatar
+ 1
can i use the dynamic memory in this case ?
25th Apr 2017, 10:33 PM
De Vinci
+ 1
it's a long long, a 64 bit integer. int and long int are the same afaik, both are 32 bit, and your number is bigger than that.
27th Apr 2017, 1:22 AM
lion
lion - avatar
0
Long int should be used to store that number u mentioned as it is not possible to store such a larger value in int...
29th Apr 2018, 4:05 PM
Harsha Virat
Harsha Virat - avatar
- 1
Its a long int
26th Apr 2017, 2:07 AM
Mostafa Mohammadi
Mostafa Mohammadi - avatar
- 1
Have you Facebook
26th Apr 2017, 2:08 AM
يوسف الرشيدي
يوسف الرشيدي - avatar