C program to print tokens from a sentence one below the other




This program will help u to separate tokens 

and print them........!!!!


#include <stdio.h>

#include <string.h>
int main()

{


  char text[80];

  char *token;


    printf("Enter a sentence:\n");

gets(text);

    token=strtok(text, " ");


    while(token != NULL)
    {


    printf(" %s\n",token);


    token= strtok(NULL, " ");


    }
}


please mail if any error in this given program 

or any clarification.....!!

please do comment...!!!!!!


Comments