char** explode(char delimiter, char* str) {
int l = strlen(str), i=0, j=0, k=0;
char x = NULL;
char** r = (char**)realloc(r, sizeof(char**));
r[0] = (char*)malloc(l*sizeof(char));
while (i<l+1) {
x = str[i++];
if (x==delimiter || x=='\0') {
r[j][k] = '\0';
r[j] = (char*)realloc(r[j], k*sizeof(char));
k = 0;
r = (char**)realloc(r, (++j+1)*sizeof(char**));
r[j] = (char*)malloc(l*sizeof(char));
} else {
r[j][k++] = x;
}
}
return r;
}
void setup() {
Serial.begin(115200);
char S[] = "1,2,3,5,10,68,79";
int i = 0,m = 0;
char** a = explode(',',S);
//Принтуем массив
for (i = 0; i < 7; i++) {
Serial.println(a[i]);
}
}
void loop() {
// put your main code here, to run repeatedly:
}