c program for strtok

c program for strtok 

#include <string.h>
#include <stdio.h>
  
int main()

{

   char str[80] = "I-am-captain-neel-jack-sparrow";

   const char s[2] = "-";

   char *token;
  
   /* get the first token */

   token = strtok(str, s);
  
   /* walk through other tokens */

   while( token != NULL )

   {

      printf( " %s\n", token );
  
      token = strtok(NULL, s);

   }
  
   return(0);

}

 output:

h-4.2$ main                                                                                                                                                                          

 I                                                                                                                                                                                            

 am                                                                                                                                                                                                

 captain                                                                                                                                                                                          

 neel                                                                                                                                                                                              

 jack                                                                                                                                                                                              

 sparrow