[ create a new paste ] login | about

Link: http://codepad.org/12Ap8HUK    [ raw code | output | fork ]

C, pasted on Apr 28:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/* strtok example */
#include <stdio.h>
#include <string.h>

int main ()
{
  char str[] ="Hello World && How are u doing && more words & bla &";
  char * pch;
  char* s = str;  
  while ((pch = strstr(s, "&&")) != NULL)
  {
    *pch = 0;
    printf("%s\n", s);  
    s = pch+2;
  }
  printf("%s\n", s);  
  return 0;
}


Output:
1
2
3
Hello World 
 How are u doing 
 more words & bla &


Create a new paste based on this one


Comments: