Write out the memory map for following code, providing allvalues at the end of execution. (b)How many
Fantastic news! We've Found the answer you've been seeking!
Question:
(b)How many total bytes does this code declare for variables??(5)
#include
typedef struct amount {
int dollars;
char cents;
}money;
main( )
{
money a, *b;
a.dollars = 1;
a.cents = 99;
b=&a;
b-->cents = 75;
}
(a) eg. table
Lable Address Value
a.dollars 0 -4 1
a.cents 5 - 9 99
:
:
(b) eg. int dollars = 4 bytes & char cents = 1 byte thereforemoney = 5 bytes
variable a = 5 byte
variable b is a pointer therefore b = 4 bytes
Related Book For
Computer Architecture A Quantitative Approach
ISBN: 978-0123704900
4th edition
Authors: John L. Hennessy, David A. Patterson
Posted Date: