Skip to content
Snippets Groups Projects
Commit 6aab0548 authored by orestis.malaspin's avatar orestis.malaspin
Browse files

Merge branch 'stack_init' into 'main'

Added init function

See merge request !8
parents 1ccc0ef1 93cf8510
Branches
Tags
1 merge request!8Added init function
#include "stack.h"
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#define DEFAULT_CAPACITY 4
void stack_init(stack *s)
{
s->top = -1;
s->capacity = DEFAULT_CAPACITY;
s->data = malloc(sizeof(int) * DEFAULT_CAPACITY);
}
\ No newline at end of file
......@@ -7,4 +7,6 @@ typedef struct _stack {
int top;
} stack;
void stack_init(stack *stack);
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment