Created
August 5, 2022 02:09
-
-
Save webgtx/6d0f6997efefa70ccd3c06bc28cdf6cb to your computer and use it in GitHub Desktop.
strtok sample in string.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <string.h> | |
| #include <stdio.h> | |
| int main () { | |
| char str[80] = "This is - www.tutorialspoint.com - website"; | |
| 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); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment