#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main() {
int indice = 0, indiceParcial = 0;
int *vetor
= malloc(sizeof(int) * 10); while (1) {
int valor;
if (valor == 0) break;
vetor[indice++] = valor;
if (indiceParcial++ == 9) {
int *vetorAuxiliar
= malloc(sizeof(int) * (indice
+ 10)); memcpy(vetorAuxiliar
, vetor
, indice
* sizeof(int)); vetor = vetorAuxiliar;
indiceParcial = 0;
}
}
for (int i
= 0; i
< indice
; i
++) printf("%d ", vetor
[i
]); }
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdGRsaWIuaD4KI2luY2x1ZGUgPHN0cmluZy5oPgoKaW50IG1haW4oKSB7CiAgICBpbnQgaW5kaWNlID0gMCwgaW5kaWNlUGFyY2lhbCA9IDA7CiAgICBpbnQgKnZldG9yID0gbWFsbG9jKHNpemVvZihpbnQpICogMTApOwogICAgd2hpbGUgKDEpIHsKICAgICAgICBpbnQgdmFsb3I7CiAgICAgICAgc2NhbmYoIiVkIiwgJnZhbG9yKTsKICAgICAgICBpZiAodmFsb3IgPT0gMCkgYnJlYWs7CiAgICAgICAgdmV0b3JbaW5kaWNlKytdID0gdmFsb3I7CiAgICAgICAgaWYgKGluZGljZVBhcmNpYWwrKyA9PSA5KSB7CiAgICAgICAgCWludCAqdmV0b3JBdXhpbGlhciA9IG1hbGxvYyhzaXplb2YoaW50KSAqIChpbmRpY2UgKyAxMCkpOwogICAgICAgICAgICBtZW1jcHkodmV0b3JBdXhpbGlhciwgdmV0b3IsIGluZGljZSAqIHNpemVvZihpbnQpKTsKICAgICAgICAgICAgZnJlZSh2ZXRvcik7CiAgICAgICAgICAgIHZldG9yID0gdmV0b3JBdXhpbGlhcjsKICAgICAgICAgICAgaW5kaWNlUGFyY2lhbCA9IDA7CiAgICAgICAgfQogICAgfQogICAgcHJpbnRmKCJcbiIpOwogICAgZm9yIChpbnQgaSA9IDA7IGkgPCBpbmRpY2U7IGkrKykgcHJpbnRmKCIlZCAgIiwgdmV0b3JbaV0pOwp9