Question: C code problem The function GetFifo returns two parameters. The return parameter is a boolean specifying whether or not the request was successful, and the

C code problem

C code problem The function GetFifo returns two parameters. The return parameteris a boolean specifying whether or not the request was successful, and

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. #de fine FifoSize 10 /* Number of 8-bit data in FIFO * unsigned char Put1!/* Index of where to put next */ unsigned char Get unsigned char Size; char Fifo FifoSize; FIFO data */ /* Index of where to get next */ * Number currently in the FIFO */ int GetFifo (char *datapt) /* empty if Size-0 / return (0); elset Size-; return (-1) char InChar (void)H char data-0 return (data); * Questions: Sketch a simple diagram that illustrates the different scope of variables in the code. Use any notation you want to show global versus local variables and pointer variables. You are not given information about actual memory addresses, so do not try to set up a memory diagram. ii. What would happen if GetFifo is called instead with the following parameter GetFifo (data)

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!