Well, I was testing the strtok
function, but it's giving me this problem of "segmentation failure (recorded core image)".
Before I tried to strPtr [i] = strtok (str1, str2);
but gave this error:
"error: assignment to expression with array type error"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main (void)
{
char str1[] = "Teste de funcao que separa string em tokens";
char str2[] = " ";
char strPtr[10][10];
char *aux;
int i;
aux = strtok (str1, str2);
strcpy (strPtr[0], aux);
for (i = 1; strPtr[i] != NULL; i++)
{
aux = strtok (NULL, str2);
strcpy (strPtr[i], aux);
}
for (i = 0; i < 10; i++)
{
puts(strPtr[i]);
}
return 0;
}