0

what is long and short in data types ?

29th Jul 2016, 12:20 PM
Bassil Orabii
Bassil Orabii - avatar
2 ответов
+ 2
#include <iostream> using namespace std; int main() { cout << "long:" << sizeof(long) << endl; cout << "short:" << sizeof(short) << endl; return 0; } a long data type is a whole number that is >= the standard int. A short data type is for numbers that take up less storage. Take this code and run it and you should get 4 2
29th Jul 2016, 3:31 PM
Jaque
Jaque - avatar
0
and why would i need it in the first place , i mean isn't declaring a variable as integer or say floating point is enough to assign any kind of numbers to it ?
29th Jul 2016, 5:04 PM
Bassil Orabii
Bassil Orabii - avatar