forked from yourtion/LearningMasteringAlgorithms-C
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathqueue.c
More file actions
37 lines (30 loc) · 1.2 KB
/
queue.c
File metadata and controls
37 lines (30 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//
// queue.c
// Algorithms - queue
//
// Created by YourtionGuo on 25/04/2017.
// Copyright © 2017 Yourtion. All rights reserved.
//
#include "list.h"
#include "queue.h"
#pragma mark - Public
/*****************************************************************************
* *
* ----------------------------- queue_enqueue ---------------------------- *
* *
*****************************************************************************/
int queue_enqueue(Queue *queue, const void *data)
{
/// 入队
return list_ins_next(queue, list_tail(queue), data);
}
/*****************************************************************************
* *
* ----------------------------- queue_dequeue ---------------------------- *
* *
*****************************************************************************/
int queue_dequeue(Queue *queue, void **data)
{
/// 出队
return list_rem_next(queue, NULL, data);
}