#include <stdio.h>
#include <stdlib.h>
char *nome(char text[]) {
int n3 = 0;
int n2 = 0;
char *n = NULL;
while((n2
= getchar()) != '\0' && n2
!= EOF
) { if (n == NULL) {
puts("Erro ao realocar!"); }
*(n + (n3 - 1)) = n2;
}
*(n + n3) = '\0';
return n;
}
int main(void) {
char *name = nome("Nome:");
char *iterador = name;
while(*iterador
!= '\0') printf("%c", *iterador
++); printf("%s", name
); //bem mais simples, certo? }
//https://pt.stackoverflow.com/q/213845/101
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdGRsaWIuaD4KCmNoYXIgKm5vbWUoY2hhciB0ZXh0W10pIHsgICAgCiAgICBpbnQgbjMgPSAwOwogICAgaW50IG4yID0gMDsKICAgIGNoYXIgKm4gPSBOVUxMOwogICAgd2hpbGUoKG4yID0gZ2V0Y2hhcigpKSAhPSAnXDAnICYmIG4yICE9IEVPRikgewogICAgICAgIG4gPSByZWFsbG9jKG4sICsrbjMpOwogICAgICAgIGlmIChuID09IE5VTEwpIHsKICAgICAgICAgICAgcHV0cygiRXJybyBhbyByZWFsb2NhciEiKTsKICAgICAgICAgICAgZXhpdCgwKTsKICAgICAgICB9CiAgICAgICAgKihuICsgKG4zIC0gMSkpID0gbjI7ICAgCiAgICB9CiAgICAqKG4gKyBuMykgPSAnXDAnOyAgCiAgICByZXR1cm4gbjsKfSAgIAoKaW50IG1haW4odm9pZCkgeyAgCiAgICBjaGFyICpuYW1lID0gbm9tZSgiTm9tZToiKTsKICAgIGNoYXIgKml0ZXJhZG9yID0gbmFtZTsKICAgIHdoaWxlKCppdGVyYWRvciAhPSAnXDAnKSBwcmludGYoIiVjIiwgKml0ZXJhZG9yKyspOwogICAgcHJpbnRmKCIlcyIsIG5hbWUpOyAvL2JlbSBtYWlzIHNpbXBsZXMsIGNlcnRvPwogICAgZnJlZShuYW1lKTsKfQoKLy9odHRwczovL3B0LnN0YWNrb3ZlcmZsb3cuY29tL3EvMjEzODQ1LzEwMQ==