0

What is the output of this code?why?

int main () { static double i; i=20; cout<<sizeof(i); }

15th Nov 2017, 8:33 AM
sai mahale
sai mahale - avatar
2 Antworten
+ 3
The code outputs 8, which is the size (in bytes) of a double type variable i, why? the sizeof() returns that value (the double type variable i size) and cout stream the value to the screen. Hth, cmiiw
15th Nov 2017, 8:52 AM
Ipang
+ 1
Output is 8 because sizeof is a function that returns the size of a variable or a constant. The default size of double is 8 bytes
15th Nov 2017, 8:46 AM
Eligijus Silkartas
Eligijus Silkartas - avatar