#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
typedef struct cel {
char conteudo;
struct cel *prox;
} celula;
void empilha(char c, celula *topo) {
celula
*nova
= malloc(sizeof(celula
)); nova->conteudo = c;
nova->prox = topo->prox;
topo->prox = nova;
}
char desempilha(celula *topo) {
celula *pt = topo->prox;
char c = pt->conteudo;
topo->prox = pt->prox;
return c;
}
int main() {
char frase[50];
celula cabeca;
celula *topo = &cabeca;
topo->prox = NULL;
for (int i = 0; frase[i] != '\0'; i++) {
empilha(frase[i], topo);
}
while (topo->prox != NULL) {
}
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdGRsaWIuaD4KI2luY2x1ZGUgPG1hbGxvYy5oPgoKdHlwZWRlZiBzdHJ1Y3QgY2VsIHsKICAgIGNoYXIgY29udGV1ZG87CiAgICBzdHJ1Y3QgY2VsICpwcm94Owp9IGNlbHVsYTsKCnZvaWQgZW1waWxoYShjaGFyIGMsIGNlbHVsYSAqdG9wbykgewogICAgY2VsdWxhICpub3ZhID0gbWFsbG9jKHNpemVvZihjZWx1bGEpKTsKICAgIG5vdmEtPmNvbnRldWRvID0gYzsKICAgIG5vdmEtPnByb3ggPSB0b3BvLT5wcm94OwogICAgdG9wby0+cHJveCA9IG5vdmE7Cn0KCmNoYXIgZGVzZW1waWxoYShjZWx1bGEgKnRvcG8pIHsKICAgIGNlbHVsYSAqcHQgPSB0b3BvLT5wcm94OwogICAgY2hhciBjID0gcHQtPmNvbnRldWRvOwogICAgdG9wby0+cHJveCA9IHB0LT5wcm94OwogICAgZnJlZShwdCk7CiAgICByZXR1cm4gYzsKfQoKaW50IG1haW4oKSB7CiAgICBjaGFyIGZyYXNlWzUwXTsKICAgIGNlbHVsYSBjYWJlY2E7CiAgICBjZWx1bGEgKnRvcG8gPSAmY2FiZWNhOwogICAgdG9wby0+cHJveCA9IE5VTEw7CiAgICBwcmludGYoIkluZm9ybWUgYSBmcmFzZTogIik7CiAgICBmZ2V0cyh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