Algorithm Share
We learn by sharing
Friday, October 10, 2014
Parsing words through strtok
Here's how to parse words through strtok().
#include "stdio.h"
#include "string.h"
int main() {
char line[100];
char *pch;
while (fgets(line, 100, stdin)) {
pch = strtok(line, " \t\n");
while (pch) {
printf("B%sE\n", pch);
pch = strtok(NULL, " \t\n");
}
}
return 0;
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment