当前位置: 首页 > news >正文

杭州网站建设wguser河南今日头条最新消息

杭州网站建设wguser,河南今日头条最新消息,中文域名是什么,上海优刻得官网一、函数实现1、ClearSqStack(1)用途清理栈的空间。只需要栈顶指针和栈底指针相等,就说明栈已经清空,后续新入栈的数据可以直接覆盖,不用实际清理数据,提升了清理效率。(2)源码Statu…

一、函数实现

1、ClearSqStack

(1)用途

清理栈的空间。只需要栈顶指针和栈底指针相等,就说明栈已经清空,后续新入栈的数据可以直接覆盖,不用实际清理数据,提升了清理效率。

(2)源码

Status ClearSqStack(SqStack* S)
{JudgeAllNullPointer(S);S->TopPointer = S->BasePointer;Log("Clear SqStack   : OK\n",Info);return SuccessFlag;
}

(3)参数

参数名

说明

S

需要清理的SqStack*类型顺序栈。

2、DestroyStack

(1)说明

销毁栈。释放申请的资源。

(2)源码

Status DestroyStack(SqStack* S)
{JudgeAllNullPointer(S);free(S->BasePointer);S->TopPointer     = NULL;S->BasePointer    = NULL;S->SqStackMaxSize = 0;Log("Destroy SqStack : OK\n",Info);return SuccessFlag;
}

(3)参数

参数名

说明

S

需要销毁的SqStack*类型顺序栈。

3、PushSqStack

(1)说明

压栈。判断栈是否已满,如果已满报错,反之将数据压入栈顶即可。

(2)源码

Status PushSqStack(SqStack* S, SqElemType SE)
{JudgeAllNullPointer(S);//判断是否栈满if(GetSqStackLen(S) >= S->SqStackMaxSize){Log("SqStack is Full, Data cannot be pushed\n",Warning);return FailFlag;}//相同结构体之间,可以直接赋值。*(S->TopPointer) = SE;//CopySqElemType(S->TopPointer, &SE);//printf("%p, %p\n",S->TopPointer->StudentNum, (&SE)->StudentNum);S->TopPointer++;Log("Push SqStack    : OK\n",Info);return SuccessFlag;
}

(3)参数

参数名

说明

S

需要压栈的SqStack*类型顺序栈。

SE

需要压入栈的SqElemType类型数据。

4、PopSqStack

(1)说明

弹栈。判断栈是否已空,如果是,就抛出错误。如果不是,就下移栈顶指针,将数据赋值给SE,作为传出参数。

(2)源码

Status PopSqStack(SqStack* S, SqElemType* SE)
{JudgeAllNullPointer(S);JudgeAllNullPointer(SE);if(JudgeSqStackIsEmpty(S) == SuccessFlag){Log("SqStack is Empty, Data cannot be poped\n",Warning);return FailFlag;}S->TopPointer--;*SE = *(S->TopPointer);//CopySqElemType(SE,S->TopPointer);//printf("%p, %p\n",S->TopPointer->StudentNum, SE->StudentNum);Log("Pop SqStack     : OK\n",Info);return SuccessFlag;
}

(3)参数

参数名

说明

S

需要初始化的SqStack*类型顺序栈。

SE

需要弹出栈的SqElemType*类型数据。

二、虚机测试

gbase@czg2 LinearTable_Stack]$ make
gcc -Wall -O3 Log.c SqStack.c main.c -o TestSqStack[gbase@czg2 LinearTable_Stack]$ ./TestSqStack 
2023-2-14 9:53:20--Info--Init SqStack    : OK
2023-2-14 9:53:20--Info--Push SqStack    : OK
2023-2-14 9:53:20--Info--Push SqStack    : OK
2023-2-14 9:53:20--Info--Push SqStack    : OK
2023-2-14 9:53:20--Info--Push SqStack    : OK
2023-2-14 9:53:20--Info--Push SqStack    : OK
2023-2-14 9:53:20--Info--Push SqStack    : OK
2023-2-14 9:53:20--Warning--SqStack is Full, Data cannot be pushed
2023-2-14 9:53:20--Warning--SqStack is Full, Data cannot be pushed
2023-2-14 9:53:20--Debug--Judge SqStack  : Not Empty
2023-2-14 9:53:20--Debug--SqStack Data   :
StudentNum     : X666
StudentName    : Sun
StudentScore   : 100
+++++++++++++++
StudentNum     : X666
StudentName    : Sun
StudentScore   : 101
+++++++++++++++
StudentNum     : X666
StudentName    : Sun
StudentScore   : 102
+++++++++++++++
StudentNum     : X666
StudentName    : Sun
StudentScore   : 103
+++++++++++++++
StudentNum     : X666
StudentName    : Sun
StudentScore   : 104
+++++++++++++++
StudentNum     : X666
StudentName    : Sun
StudentScore   : 105
+++++++++++++++
SqStackLen     : 6
SqStackMaxSize : 6
2023-2-14 9:53:20--Debug--Judge SqStack  : Not Empty
2023-2-14 9:53:20--Info--Pop SqStack     : OK
2023-2-14 9:53:20--Debug--SqElemType Data:
StudentNum     : X666
StudentName    : Sun
StudentScore   : 105
2023-2-14 9:53:20--Debug--Judge SqStack  : Not Empty
2023-2-14 9:53:20--Info--Pop SqStack     : OK
2023-2-14 9:53:20--Debug--SqElemType Data:
StudentNum     : X666
StudentName    : Sun
StudentScore   : 104
2023-2-14 9:53:20--Debug--Judge SqStack  : Not Empty
2023-2-14 9:53:20--Info--Pop SqStack     : OK
2023-2-14 9:53:20--Debug--SqElemType Data:
StudentNum     : X666
StudentName    : Sun
StudentScore   : 103
2023-2-14 9:53:20--Debug--Judge SqStack  : Not Empty
2023-2-14 9:53:20--Info--Pop SqStack     : OK
2023-2-14 9:53:20--Debug--SqElemType Data:
StudentNum     : X666
StudentName    : Sun
StudentScore   : 102
2023-2-14 9:53:20--Debug--Judge SqStack  : Not Empty
2023-2-14 9:53:20--Info--Pop SqStack     : OK
2023-2-14 9:53:20--Debug--SqElemType Data:
StudentNum     : X666
StudentName    : Sun
StudentScore   : 101
2023-2-14 9:53:20--Debug--Judge SqStack  : Not Empty
2023-2-14 9:53:20--Info--Pop SqStack     : OK
2023-2-14 9:53:20--Debug--SqElemType Data:
StudentNum     : X666
StudentName    : Sun
StudentScore   : 100
2023-2-14 9:53:20--Debug--Judge SqStack  : Empty
2023-2-14 9:53:20--Warning--SqStack is Empty, Data cannot be poped
2023-2-14 9:53:20--Debug--Judge SqStack  : Empty
2023-2-14 9:53:20--Warning--SqStack is Empty, Data cannot be poped
2023-2-14 9:53:20--Debug--SqStack Data   :
SqStackLen     : 0
SqStackMaxSize : 6
2023-2-14 9:53:20--Info--Clear SqStack   : OK
2023-2-14 9:53:20--Info--Destroy SqStack : OK
http://www.ds6.com.cn/news/47021.html

相关文章:

  • 设计微信公众号的网站吗河南网站优化公司哪家好
  • 浦东网站建设价格怎么建立网站的步骤
  • 商城网站开发的任务书关键词权重查询
  • 靠谱网站建设公司怎么选搜索引擎seo关键词优化方法
  • 外网专门做钙片的网站百度数据平台
  • vue单页面做网站加载慢百度店铺怎么开通
  • web前端和网站开发电商培训
  • 做网站设计的全网推广的方式有哪些
  • 陕西做网站的公司电话乐清网站建设
  • 方便面网络营销推广方案厦门seo网站推广优化
  • 商业网站建设开发中心襄阳网站推广优化技巧
  • 有没有个人做的网站赚流量费上海网站建设公司
  • 怎么做站旅游网站上泡到妞简单网页设计模板html
  • 外贸网站如何做seocps推广
  • 北京做网站费用百度的网站
  • 怎么做网站上翻译泰剧sem优化推广
  • 企业网站建设申请域名磁力狗最佳搜索引擎
  • 长沙河西做网站b2b网站大全免费
  • 设计师网名女如何做seo
  • 南宁网站建公司网站统计器
  • 沂水住房与城乡建设局网站网络推广推广
  • 商务网站制作语言基础百度管理员联系方式
  • 网站建设技术人员域名查询网
  • 网站做ppt模板百度推广开户渠道
  • 四川炜航建筑公司网站线上销售如何找到精准客户
  • 深圳网站建设论坛百度搜索风云榜游戏
  • 网站注册了域名然后怎么做百度网站推广价格查询
  • 在线视频网站开发方案php网络营销带来的效果
  • seo网站做推广公司如何做网站推广优化
  • 台州做网站哪家好软文技巧