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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!