declarations go at the beginning of blocks ex:main I can see you are trying. This is what you want right? Does this help you?
P.S. I prefer you not use strtok though for reasons I stated earlier
Code:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main (void){
char mytext[] = "this is an example of how to use token";
char *ptr=malloc(40),*token;
if(!ptr){
printf("Not Enough Memory\n");
return EXIT_FAILURE;
}
strcpy(ptr,mytext);
token=strtok(ptr," ");
printf("Stopped String: \n");
while(token){
printf("%s\n",token);
token=strtok(NULL," ");
}
return 0;
free (ptr);
}