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)
(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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get StartedRecommended Textbook for
Computer Architecture A Quantitative Approach
Authors: John L. Hennessy, David A. Patterson
4th edition
123704901, 978-0123704900
Students also viewed these Databases questions
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
View Answer in SolutionInn App