#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char** split(char *str, int *qtd){
*qtd = 0;
char **strings = NULL;
int i = 0;
while (pch != NULL){
strings
= realloc(strings
, sizeof(char*) * (*qtd
+ 1)); }
return strings;
}
int main () {
char str[] = "Bom dia pessoal";
int qtd_strings, i;
char **strings = split(str, &qtd_strings);
for (i = 0;i < qtd_strings;++i){
}
//mostrar cada uma
for (i = 0;i < qtd_strings;++i){
}
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdGRsaWIuaD4KI2luY2x1ZGUgPHN0cmluZy5oPgoKY2hhcioqIHNwbGl0KGNoYXIgKnN0ciwgaW50ICpxdGQpewogICAgKnF0ZCA9IDA7CiAgICBjaGFyICoqc3RyaW5ncyA9IE5VTEw7CiAgICBpbnQgaSA9IDA7CiAgICBjaGFyICpwY2ggPSBzdHJ0b2sgKHN0ciwiICIpOwogICAgd2hpbGUgKHBjaCAhPSBOVUxMKXsKICAgICAgICBzdHJpbmdzID0gcmVhbGxvYyhzdHJpbmdzLCBzaXplb2YoY2hhciopICogKCpxdGQgKyAxKSk7CiAgICAgICAgc3RyaW5nc1tpXSA9IG1hbGxvYyhzdHJsZW4ocGNoKSArIDEpOwogICAgICAgIHN0cmNweShzdHJpbmdzW2krK10sIHBjaCk7CiAgICAgICAgcGNoID0gc3RydG9rIChOVUxMLCAiICIpOwogICAgfQoKICAgIHJldHVybiBzdHJpbmdzOwp9CgppbnQgbWFpbiAoKSB7CiAgICBjaGFyIHN0cltdID0gIkJvbSBkaWEgcGVzc29hbCI7CgogICAgaW50IHF0ZF9zdHJpbmdzLCBpOwogICAgY2hhciAqKnN0cmluZ3MgPSBzcGxpdChzdHIsICZxdGRfc3RyaW5ncyk7CiAgICBmb3IgKGkgPSAwO2kgPCBxdGRfc3RyaW5nczsrK2kpewogICAgICAgIHByaW50ZigiJXNcbiIsIHN0cmluZ3NbaV0pOwogICAgfQoKICAgIC8vbW9zdHJhciBjYWRhIHVtYQogICAgZm9yIChpID0gMDtpIDwgcXRkX3N0cmluZ3M7KytpKXsKICAgICAgICBwcmludGYoIiVzXG4iLCBzdHJpbmdzW2ldKTsKICAgIH0gIAogICAgcmV0dXJuIDA7Cn0K