Alguem podertia me ajudar no exercicio abaixo:
Implementar em linguagem C uma “pilha” e programar as seguintes funções:
push()
pop()
top()
empty()
Para realizar o cadastro, você pode preencher o formulário ou optar por uma das opções de acesso rápido disponíveis.
Por favor, insira suas informações de acesso para entrar ou escolha uma das opções de acesso rápido disponíveis.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
typedef struct lstack *stack;
typedef struct lstack{
double value;
stack next;
}dl_stack;
stack init (void){
return NULL;
}
double stack_top(stack s){
return s->value;
}
void stack_topln (stack s){
if (s)
printf(“%.4f\n”,stack_top(s));
}
void stack_push (stack *s,double x){
stack r = (stack) malloc (sizeof(dl_stack));
r->value=x;
r->next=*s;
*s=r;
}
void stack_pop (stack *s){
if (*s){
stack r=*s;
*s = (*s)->next;
free(r);
}
}
acho que ta ai tudo
espero ter ajudado.