Advertisement
homer512

strchr example

Nov 26th, 2013
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.29 KB | None | 0 0
  1. #include <string.h>
  2. // using strchr
  3. #include <stdio.h>
  4. // using printf
  5.  
  6. int main()
  7. {
  8.   const char* input = "Foo Bar Baz";
  9.   printf("Whole input: %s\n", input);
  10.   for(const char* pos = input; (pos = strchr(pos, ' ')) != NULL; pos += 1)
  11.     printf("One word less:%s\n", pos);
  12.   return 0;
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement