Assume that each integer variable occupies four bytes How mu

Assume that each integer variable occupies four bytes. How much total space is required for
the variables in this code? Justify your answer.

int a, b, c i\' in d, e; int fi i\" int g, h, i,

Solution

Answer : 24 bytes

A b c require 12 bytes

D e need 8 more bytes, but once the curly bracket ends, that 8 bytes are getting free.

The g h i requires 12 more bytes, but those are also getting free at the end.

So inside the g h i bracket, that is when most bytes are used, because a b c g h i all of them existed at that point.

So those are 6 variables and 6*4=24 bytes

Assume that each integer variable occupies four bytes. How much total space is required for the variables in this code? Justify your answer. int a, b, c i\' in

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site