int capacity =4;
struct Stack* stack =
(struct Stack*) malloc(sizeof(struct Stack));
stack -> capacity = capacity;
stack -> top = -1;
stack -> array = (int*) malloc(stack -> capacity * sizeof(int));
将为堆栈和数组分配什么大小。数组内存分配是否会在堆栈下进行,否则将分开分配。什么大小将被分配给堆栈和数组。数组内存分配是否会叠加或将分别分配
谁教你施放'malloc'的结果? – DeiDei
@DeiDei可能有人用过C++编译器编译c代码;) – LPs