Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- char *my_strdup(char *dest, char *src)
- {
- int i;
- int c;
- char *new_way;
- i = 0;
- c = 2;
- while (src[i])
- i++;
- if ((new_way = malloc(sizeof(*new_way) * (i + 3))) == NULL)
- return (NULL);
- i = 0;
- new_way[0] = '.';
- new_way[1] = '/';
- while (src[i])
- {
- new_way[c] = src[i];
- c++;
- i++;
- }
- new_way[c] = '\0';
- return (dest);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement