I'm trying to implement a stack using array in #c. I have created the implementation and the header files, then linked the stack C library from linker setting. The structure of the stack is included only in the header file stack.h.
#define max_stack 100
Typedef int stackentry ;
typedef struct stack
{int top; stackentry entry[max_stack] ;} STack;
I include the stack.h in both main.c and stack.c but the problem is When I first build and run its okay but with any modification in the stack size through changing max_stack in the header file it doesn't affect the output That was clear when I make
#define max_stack 5
Then using push function more than five times while taking into consideration the full stack mechanism test before pushing and it pushes without looking to the array size which is 5 in that case. The compiler only sees it as 100 which is first declared.