Last active
June 14, 2017 04:28
-
-
Save Romain-P/33e8e28bdc603fe19d6dddd200d2afb1 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
| #include <stdlib.h> | |
| char *strdupl(char const *str) | |
| { | |
| char *new; | |
| int i; | |
| i = 0; | |
| while (str && str[i] && ++i); | |
| if (!(new = malloc(sizeof(char) * (i + 1)))) | |
| return (NULL); | |
| new[i] = 0; | |
| while (--i >= 0) | |
| new[i] = str[i]; | |
| return (new); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment