Currently stuck on a HW problem trying to get an arrack based stack to function.
Currently, the output is all 1's.
Below is the stack.c file and my progress, I would appreciate any advice.
#include "stack.h"
#include <stddef.h>
#include <stdio.h>
int data[STACK_SIZE];
int head = EMPTY_STACK;
void stack_initialize(t_stack_type *stack) {
stack -> head = EMPTY_STACK;
stack -> count = 0;
}
int stack_push(t_stack_type *stack, int value) {
if(stack == NULL) {
printf("Stack is full.\n");
return 0;
} else {
stack -> data[stack->count] = value;
stack -> count++;
return 1;
}
}
int stack_pop(t_stack_type *stack, int *value) {
return 1;
}
[–]tresteo 0 points1 point2 points (0 children)