If the stack is successful, why does the stack break the code?

  c++, question
#include<iostream>
 #include<stdio.h>
 #define STACK_INIT_SIZE 100 // initial allocation of storage space
 #define STACKINCREMENT 10// storage space allocation increment
 typedef struct
 {
 int *base;  //After the stack is constructed and destroyed, the value of base is NULL
 int *top;  //stack top pointer
 int stacksize;  //The storage space allocated by the current stack, in units of elements
 }Sqstack;
 Voidenittack (sqstack & s)//constructs an empty stack
 {
 S.base = (int *)alloca(STACK_INIT_SIZE*sizeof(int));
 if (!  S.base) exit(OVERFLOW);
 S.top = S.base;
 S.stacksize = STACK_INIT_SIZE;  //Initial allocation of storage space 100
 }
 bool Push(Sqstack &S, int e)
 {
 //Insert Element E as Top of Stack Element
 If (s.top-s.base > = s.stacksize)//stack full additional storage space
 {
 S.base = (int *)realloc(S.base, (S.stacksize + STACKINCREMENT)*sizeof(int));
 if (!  S.base) { exit(OVERFLOW);   return false;  }//allocation failed
 S.top = S.base + S.stacksize;
 S.stacksize += STACKINCREMENT;
 }
 *S.top++= e;
 return true;
 }//push
 bool Pop(Sqstack &S, int &e)
 {
 //if the stack is not empty, delete the top element of the stack, return value with e, return true, otherwise return false
 if (S.top == S.base) return false;  //empty stack
 e = *--S.top;
 return true;
 }//pop
 bool IsEmpty(Sqstack S)
 {
 //Judge whether the stack is empty
 if (S.top == S.base)return true;
 return false;
 }
 void Conversion(int x)
 {
 //Convert Decimal Number
 Sqstack S;
 int temp;
 InitStack(S);  //Construct Empty Stack
 if (x == 0)printf("0");
 else
 {
 while (x)
 {
 Push(S, x % 2);
 x /= 2;
 }//divide the decimal number short and put it on the stack
 while (!  IsEmpty(S))
 {
 Pop(S, temp);
 printf("%d", temp);
 }//Reverse Output
 }
 putchar(10);
 }//Conversion
 int main()
 {
 Printf("************** Non-recursive algorithm **************\n ");
 for (int i = 0;   i < 16;  i++)
 Conversion(i);
 system("pause");
 return 0;
 }

Pop(S, &temp);
I saw someone mention it in the commentary.alloca, nest to notice, originallyallocaIs the memory allocated on the stack. . . This type of memory is automatically reclaimed by the system after the function calling it ends.