#include <iostream>
typedef struct pilha pilha;
struct pilha
{
int *v;
int topo;
int tam_max;
};
void Inicializar_Pilha (pilha *pi, int tam_max) //agora com * para ser ponteiro
{
pi->v=new int [tam_max]; //-> em vez de . porque é ponteiro
pi->topo=-1; //agora com ->
pi->tam_max=tam_max;//agora com ->
//return; //return no fim de uma função void não faz sentido
}
int main(){
pilha p1;
Inicializar_Pilha(&p1, 10);
std::cout<<p1.topo<<" "<<p1.tam_max;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKdHlwZWRlZiBzdHJ1Y3QgcGlsaGEgcGlsaGE7CnN0cnVjdCBwaWxoYQp7CgogICAgaW50ICp2OwogICAgaW50IHRvcG87CiAgICBpbnQgdGFtX21heDsKfTsKCgp2b2lkIEluaWNpYWxpemFyX1BpbGhhIChwaWxoYSAqcGksIGludCB0YW1fbWF4KSAvL2Fnb3JhIGNvbSAqIHBhcmEgc2VyIHBvbnRlaXJvCnsKCiAgICBwaS0+dj1uZXcgaW50IFt0YW1fbWF4XTsgLy8tPiBlbSB2ZXogZGUgLiBwb3JxdWUgw6kgcG9udGVpcm8KICAgIHBpLT50b3BvPS0xOyAvL2Fnb3JhIGNvbSAtPgogICAgcGktPnRhbV9tYXg9dGFtX21heDsvL2Fnb3JhIGNvbSAtPgogICAgLy9yZXR1cm47IC8vcmV0dXJuIG5vIGZpbSBkZSB1bWEgZnVuw6fDo28gdm9pZCBuw6NvIGZheiBzZW50aWRvCn0KCmludCBtYWluKCl7CiAgICBwaWxoYSBwMTsKICAgIEluaWNpYWxpemFyX1BpbGhhKCZwMSwgMTApOwoKICAgIHN0ZDo6Y291dDw8cDEudG9wbzw8IiAiPDxwMS50YW1fbWF4OwoKICAgIHJldHVybiAwOwp9