Hello!
Iam having some problem with my c program again. Hope you can help me.
I have been working with this for some hours now
I am trying to make a split function, split a string into an array, I know the number of elements and the delimiter but I am getting some warnings and the program does not work
This is how it looks
Code:
void linetoArray(char* line, unsigned long* arr){
char delims[] = " ";
char *result = NULL;
result = strtok( line, &delims[0] ); // problem here
while( result != NULL )
{
printf( "result is \"%s\"\n", result );
result = strtok( NULL, &delims[0] ); // problem here
}
}
My line looks like this
char * line = "aaa bbb ccc ddd";
And my array have 4 places
I have the warning: assigment makes pointer from integer without a cast
I have tried sending only delims, and (char*)delims but still the same problem
Tips?