#include <stdio.h>
#include <string.h>
int main(void) {
char entrada[100]; // Para obter até 100 caracteres da entrada
int * elementos[10]; // Array com capacidade para 10 elementos
int i = 0;
int tamanhoArray = sizeof elementos / sizeof(int);
if(fgets(entrada
, sizeof entrada
, stdin
) != NULL
) { for (char *pedaco
= strtok(entrada
, " "); pedaco
!= NULL
; pedaco
= strtok(NULL
, " ")) {
// Se atingir a capacidade do array
if (i >= tamanhoArray) {
puts("Não foi possível adicionar mais itens na lista!"); break;
}
elementos[i++] = pedaco;
}
for (int n = 0; n < tamanhoArray; ++n) {
printf("Indice [%d] = %s\n", n
, elementos
[n
]); }
}
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdHJpbmcuaD4KCmludCBtYWluKHZvaWQpIHsKCWNoYXIgZW50cmFkYVsxMDBdOyAgIC8vIFBhcmEgb2J0ZXIgYXTDqSAxMDAgY2FyYWN0ZXJlcyBkYSBlbnRyYWRhCglpbnQgKiBlbGVtZW50b3NbMTBdOyAvLyBBcnJheSBjb20gY2FwYWNpZGFkZSBwYXJhIDEwIGVsZW1lbnRvcwoJaW50IGkgPSAwOwoJCglpbnQgdGFtYW5ob0FycmF5ID0gc2l6ZW9mIGVsZW1lbnRvcyAvIHNpemVvZihpbnQpOwoJCglpZihmZ2V0cyhlbnRyYWRhLCBzaXplb2YgZW50cmFkYSwgc3RkaW4pICE9IE5VTEwpIHsKCQlmb3IgKGNoYXIgKnBlZGFjbyA9IHN0cnRvayhlbnRyYWRhLCAiICIpOyBwZWRhY28gIT0gTlVMTDsgcGVkYWNvID0gc3RydG9rKE5VTEwsICIgIikpIHsKCQkJCgkJCS8vIFNlIGF0aW5naXIgYSBjYXBhY2lkYWRlIGRvIGFycmF5CgkJCWlmIChpID49IHRhbWFuaG9BcnJheSkgewoJCQkJcHV0cygiTsOjbyBmb2kgcG9zc8OtdmVsIGFkaWNpb25hciBtYWlzIGl0ZW5zIG5hIGxpc3RhISIpOwoJCQkJYnJlYWs7CgkJCX0KCQkJCgkJCWVsZW1lbnRvc1tpKytdID0gcGVkYWNvOwoJCX0KCQkKCQlmb3IgKGludCBuID0gMDsgbiA8IHRhbWFuaG9BcnJheTsgKytuKSB7ICAgIAoJCQlwcmludGYoIkluZGljZSBbJWRdID0gJXNcbiIsIG4sIGVsZW1lbnRvc1tuXSk7CgkJfQoJfQoJcmV0dXJuIDA7Cn0K