Question: Question 1: Pointers a. You are given the following C code and memory diagram. The contents column of the memory diagram shows the value of

 Question 1: Pointers a. You are given the following C code

and memory diagram. The "contents" column of the memory diagram shows the

Question 1: Pointers a. You are given the following C code and memory diagram. The "contents" column of the memory diagram shows the value of the variable. Update the "contents" column of the memory diagram for each assignment in main() long "pt; long data; long ouffer[4]; void main(void)t pt &buffer [i] ; pt234; data- *pt; contents variable address 0x20000000 0x0000000C 0x20000004 0x00000000 0x20000008 0x00000000 buffer[0] 0x2000000C 0x00000000 0x2000000 0x00000000 buffer [2] 0x2000004 0x00000000 buffer [3] pt data bufferl] b. Consider the following code The function GetFifo returns two parameters. The return parameter is a boolean specifying whether or not the request was successful, and the actual data removed from the queue is returned via the call-by- reference parameter. The calling program InChar passes the address of its local variable data Normally GetFifo does not have the scope to access local variables of InChar, but in this case InChar explicitly granted that right by passing a pointer to GetFifo define FifoSize 10 /* Number of 8-bit data in FIFO */ unsigned char PutI; /*Index of where to put next */ unsigned char GetI; unsigned char Size; char Fifo[FifoSize];*FIFO data */ *Index of where to get next */ Number currently in the FIFO / int GetFifo (char datapt) if (size == 0 ) returr (0); /* empty if Size=0 */ elset datapt-FifoIGetI++ Size-- if (Get.IFifoSize) GetI-0; returr (-1); char rChar (void) 1 Question 1: Pointers a. You are given the following C code and memory diagram. The "contents" column of the memory diagram shows the value of the variable. Update the "contents" column of the memory diagram for each assignment in main() long "pt; long data; long ouffer[4]; void main(void)t pt &buffer [i] ; pt234; data- *pt; contents variable address 0x20000000 0x0000000C 0x20000004 0x00000000 0x20000008 0x00000000 buffer[0] 0x2000000C 0x00000000 0x2000000 0x00000000 buffer [2] 0x2000004 0x00000000 buffer [3] pt data bufferl] b. Consider the following code The function GetFifo returns two parameters. The return parameter is a boolean specifying whether or not the request was successful, and the actual data removed from the queue is returned via the call-by- reference parameter. The calling program InChar passes the address of its local variable data Normally GetFifo does not have the scope to access local variables of InChar, but in this case InChar explicitly granted that right by passing a pointer to GetFifo define FifoSize 10 /* Number of 8-bit data in FIFO */ unsigned char PutI; /*Index of where to put next */ unsigned char GetI; unsigned char Size; char Fifo[FifoSize];*FIFO data */ *Index of where to get next */ Number currently in the FIFO / int GetFifo (char datapt) if (size == 0 ) returr (0); /* empty if Size=0 */ elset datapt-FifoIGetI++ Size-- if (Get.IFifoSize) GetI-0; returr (-1); char rChar (void) 1

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!