Where do we use Long and short datatype? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Where do we use Long and short datatype?

12th Jul 2018, 7:23 AM
Nathan
Nathan - avatar
4 Answers
0
long is for storing really large whole numbers, and short is only used when you know a value can't go over ~65000 and you want to conserve memory usage
12th Jul 2018, 7:31 AM
hinanawi
hinanawi - avatar
0
what is the difference between int and long
12th Jul 2018, 7:32 AM
Nathan
Nathan - avatar
0
Nathan the highest/lowest number they can hold, iirc int is from -2^32 to 2^31-1 and long is from -2^64 to 2^63-1
12th Jul 2018, 7:33 AM
hinanawi
hinanawi - avatar
0
that's helpful... thanks
12th Jul 2018, 7:35 AM
Nathan
Nathan - avatar