![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
c
hust_joker
这个作者很懒,什么都没留下…
展开
-
循环队列的c实现
#include <stdio.h> #include <stdlib.h> #define SUCCESS 0 #define FAILED -1 typedef struct { int * parr; int head; int tail; int length; } CircleQueue; CircleQueue queue; int init(CircleQueue* p, int length) { p->parr原创 2021-03-17 15:30:08 · 104 阅读 · 0 评论 -
va_list、va_start和va_end的用法
在项目的代码中看到函数不定参数的使用,现在总结一下va_list、va_start和va_end三个宏的用法。 c语言提供了函数的不定长参数使用,比如 void func(int a, …)。三个省略号,表示了不定长参数。注意:c标准规定了,函数必须至少有一个明确定义的参数,因此,省略号前面必须有至少一个参数。 va_list宏定义了一个指针类型,这个指针类型指向参数列表中的参数。 void va...原创 2018-09-26 16:44:02 · 11736 阅读 · 1 评论 -
基于链表的队列实现
队列接口声明: #ifndef __LINKLIST_QUEUE_H_ #define __LINKLIST_QUEUE_H_ struct unit { char data; struct unit* punit; }; struct linklistqueue { int size; struct unit* phead; struct unit* ptail; void(*pf...原创 2018-12-26 21:00:08 · 152 阅读 · 0 评论 -
基于数组的扩缩容栈实现
参照算法第四版写的基于数组的可扩容与缩容的栈实现。 非 -字符入栈,-字符出参。 接口申明文件:stack_array.h #ifndef STACK_ARRAY_H #define STACK_ARRAY_H extern int stack_array_size; void arraystackpush(char** parray, char value); char arraystackpo...原创 2018-12-24 15:37:57 · 174 阅读 · 0 评论 -
算法 1-3-4答案
array_stack.c 和array_stack.h 参展arraystack文章中的答案。 #include “stack_array.h” #include <unistd.h> #include <stdio.h> int main () { int result = test_parentheses_balance(); if(1 == result) {...原创 2018-12-24 16:22:16 · 241 阅读 · 0 评论