Answered step by step
Verified Expert Solution
Question
1 Approved Answer
c) Consider the following problem: you have implemented a ring buffer to store some incoming data. You are using an array of 56 bytes, and
c) Consider the following problem: you have implemented a ring buffer to store some incoming data.
You are using an array of 56 bytes, and each item of data is 8 bytes long.
To add data you are using the following pseudo-code:
for j=0 to 7:
buffer[i + j] = newData[j]
i = (i + 8) % 56
Later, the data specification has changed to 9 bytes long, so you change your code as follows
for j=0 to 8:
buffer[i + j] = newData[j]
i = (i + 9) % 56
but the program is producing garbage. Explain what has gone wrong. (1 mark)
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 Started