好的,以下是一个简单的C语言代码实现堆栈的出栈和入栈的函数。
#include <stdio.h>
#include <stdlib.h>
#define MAX_SIZE 100
int stack[MAX_SIZE];
int top = -1;
void push(int value) {
if (top == MAX_SIZE - 1) {
printf("Error: Stack overflow\n");
return;
}
top++;
stack[top] = value;
}
int pop()