Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #include <stdlib.h>
- int main(int argc, char *argv[]) {
- if (argc != 3) {
- fprintf(stderr, "use: %s stringa1 stringa2\n", argv[0]);
- return -1;
- }
- char *save1=NULL;
- char *cpy=malloc(sizeof(char)*(strlen(argv[2])+1));
- strcpy(cpy,argv[2]);
- char* token1 = strtok_r(argv[1], " ",&save1);
- while (token1) {
- char *save2=NULL;
- printf("%s\n", token1);
- strcpy(cpy,argv[2]);
- char* token2 = strtok_r(cpy, " ",&save2);
- while(token2) {
- printf("%s\n", token2);
- token2 = strtok_r(NULL, " ",&save2);
- }
- token1 = strtok_r(NULL, " ",&save1);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement