Skip to content
Snippets Groups Projects
Commit 9515f6e6 authored by Gaetan Siffert's avatar Gaetan Siffert
Browse files

queue_init

parent 2baac242
No related branches found
No related tags found
2 merge requests!13Add queue_init,!11Draft:queue_init
This commit is part of merge request !11. Comments created here will be created in the context of that merge request.
...@@ -4,3 +4,10 @@ bool is_empty(queue q){ ...@@ -4,3 +4,10 @@ bool is_empty(queue q){
return (q.tail<0); return (q.tail<0);
} }
void queue_init(queue *q)
{
q->capacity = -1;
q->tail = -1;
q->data = malloc(sizeof(int));
return q;
}
\ No newline at end of file
...@@ -8,5 +8,6 @@ typedef struct _queue { ...@@ -8,5 +8,6 @@ typedef struct _queue {
} queue; } queue;
bool is_empty(queue q); bool is_empty(queue q);
void queue_init(queue *q);
#endif #endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment