Question: Write out the memory map for following code, providing allvalues at the end of execution. (b)How many total bytes does this code declare for variables??(5)
Write out the memory map for following code, providing allvalues at the end of execution.
(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
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
