Код: Выделить всё
#include
using namespace std;
#define max_size 100
typedef struct stack
{
int top;
int capacity;
int items[max_size];
} stack;
stack* initialize(stack *s, int capacity)
{
s = (stack*)malloc((capacity)*sizeof(int) + sizeof(int) + sizeof(int));
s->top = -1;
if(capacity
Подробнее здесь: [url]https://stackoverflow.com/questions/77619334/am-i-doing-dynamic-memory-allocation-without-allocating-any-unnecessary-space[/url]