Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- void ft_strcpy(char *dest, char *src)
- {
- int i;
- int buffer_end;
- i = 0;
- buffer_end = 0;
- while (*src)
- {
- dest[i++] = *src;
- src++;
- }
- dest[i] = *src;
- }
- int main()
- {
- char src[] = "1234567898888";
- char dest[] = "abcdefghe";
- for (int i = 0; i <= strlen(src); i++)
- {
- printf("%c(%d) ", src[i], src[i]);
- }
- printf("\n");
- for (int i = 0; i <= strlen(dest); i++)
- {
- printf("%c(%d) ", dest[i], dest[i]);
- }
- printf("\n\n");
- ft_strcpy(src + 1, src);
- for (int i = 0; i <= strlen(src); i++)
- {
- printf("%c(%d) ", src[i], src[i]);
- }
- printf("\n");
- for (int i = 0; i <= strlen(dest); i++)
- {
- printf("%c(%d) ", dest[i], dest[i]);
- }
- printf("\n\nDone!");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement