野火电子论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 9381|回复: 2

求解惑——关于队列元素删除操作

[复制链接]
发表于 2017-4-9 09:57:22 | 显示全部楼层 |阅读模式
u8 pointq_delelement(u8 i)
{
        u8 m;
        struct pointq_element_type *p,*p1;
        if((i>pointq_manage_struct.item_amount)||(pointq_manage_struct.item_amount==0))   
        {
                return(1);                  
        }
        else
        {
                for(m=i;m<pointq_manage_struct.item_amount;m++)                  //为什么不能等于
                {
                        p=pointq_manage_struct.p+((pointq_manage_struct.head_p+m-1)%pointq_manage_struct.maxindex);      
                        p1=pointq_manage_struct.p+((pointq_manage_struct.head_p+m)%pointq_manage_struct.maxindex);
                }
                if(pointq_manage_struct.tail_p==0)                               //?
                {
                        pointq_manage_struct.tail_p=pointq_manage_struct.maxindex;
                }
                else
                {
                        pointq_manage_struct.tail_p--;
                }
                pointq_manage_struct.item_amount--;
                return(0);
        }
}


回复

使用道具 举报

发表于 2017-4-10 08:58:14 | 显示全部楼层
等于就溢出了
回复 支持 反对

使用道具 举报

 楼主| 发表于 2017-4-10 09:55:55 | 显示全部楼层

那下面的if   else语句表达的是什么意思呢?我不是很清楚      也谢谢您解惑
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

联系站长|手机版|野火电子官网|野火淘宝店铺|野火电子论坛 ( 粤ICP备14069197号 ) 大学生ARM嵌入式2群

GMT+8, 2024-5-19 03:28 , Processed in 0.047071 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表