splitting a char array

I am building a Graphics library(semi-graphical, console).
I have built most of it but I'm stuck on the part of splitting a char*
I want to do...
 
part[]=strtok(message,'\n');

The problem is part has no amount of elements... How would I fix this?
1
2
3
4
5
6
7
8
9
10
11
12
13
#include <stdio.h>
#include <string.h>

int main(){
   char string[] = "Hello there, timprograms!";
   char* token = NULL;
   while((token = strtok(string, ' ')) != NULL){
      puts(token);
      putchar('\n');
   }

   return 0;
}


http://www.cplusplus.com/reference/cstring/strtok/
Last edited on
Topic archived. No new replies allowed.