Last active
January 8, 2018 14:09
-
-
Save iomonad/8df5f65963b5cb6c65b85acd01410dc2 to your computer and use it in GitHub Desktop.
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
static void | |
_revwstr_(char *str, int first) | |
{ | |
int start; | |
int i = 0; | |
if (str[i]) { | |
while (str[i] && (str[i] == ' ' || str[i] == '\t')) | |
i++; | |
if (!str[i]) | |
return ; | |
start = i; | |
while (str[i] && (str[i] != ' ' && str[i] != '\t')) | |
i++; | |
_revstr(&s[i], 0); | |
write(1, &str[start], i - start); | |
if (!first) | |
write(1, " ", 1); | |
} | |
} |
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
static void | |
_revwstr_(char *str, int first) | |
{ | |
int start; | |
int i = 0; | |
if (str[i]) { | |
/* Incrementation vers le premier mot */ | |
while (str[i] && (str[i] == ' ' || str[i] == '\t')) { | |
i++; | |
} | |
if (!str[i]) { | |
return ; | |
} | |
/* Keep start in reference */ | |
start = i; | |
/* Incrementation sur le premier mot */ | |
while (str[i] && (str[i] != ' ' && str[i] != '\t')) { | |
i++; | |
} | |
/* Recurse operation to start at last word */ | |
_revstr(&s[i], 0); | |
/* Print last word first word */ | |
write(1, &str[start], i - start); | |
/* Helper to pass on first word */ | |
if (!first) { | |
write(1, " ", 1); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment