while(1) {while (((in+1)%BUFFER-SIZE) ==out) buffer[in]=nextproduced;in=(in+1)%BUFFER-SIZE;}这种方法最多允许缓冲的最大项数为BUFFER-SIZE-1,能否修改代码,使得将其缓冲的最大项数改为BUFFER-SIZE,即全部填满.请详细

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/15 00:11:53

while(1) {while (((in+1)%BUFFER-SIZE) ==out) buffer[in]=nextproduced;in=(in+1)%BUFFER-SIZE;}这种方法最多允许缓冲的最大项数为BUFFER-SIZE-1,能否修改代码,使得将其缓冲的最大项数改为BUFFER-SIZE,即全部填满.请详细
while(1) {while (((in+1)%BUFFER-SIZE) ==out) buffer[in]=nextproduced;in=(in+1)%BUFFER-SIZE;}
这种方法最多允许缓冲的最大项数为BUFFER-SIZE-1,能否修改代码,使得将其缓冲的最大项数改为BUFFER-SIZE,即全部填满.请详细回答.

while(1) {while (((in+1)%BUFFER-SIZE) ==out) buffer[in]=nextproduced;in=(in+1)%BUFFER-SIZE;}这种方法最多允许缓冲的最大项数为BUFFER-SIZE-1,能否修改代码,使得将其缓冲的最大项数改为BUFFER-SIZE,即全部填满.请详细
while(1) {
while ((in%(BUFFER-SIZE)) ==out)
buffer[in]=nextproduced;
in=in%(BUFFER-SIZE);
}
试试.