Advertisement
liftchampion

temp1

Oct 22nd, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.85 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. void ft_strcpy(char *dest, char *src)
  4. {
  5.     int i;
  6.     int buffer_end;
  7.    
  8.     i = 0;
  9.     buffer_end = 0;
  10.     while (*src)
  11.     {
  12.         dest[i++] = *src;
  13.         src++;
  14.     }
  15.     dest[i] = *src;
  16. }
  17.  
  18. int main()
  19. {
  20.     char src[] = "1234567898888";
  21.     char dest[] = "abcdefghe";
  22.  
  23.     for (int i = 0; i <= strlen(src); i++)
  24.     {
  25.         printf("%c(%d) ", src[i], src[i]);
  26.     }
  27.     printf("\n");
  28.     for (int i = 0; i <= strlen(dest); i++)
  29.     {
  30.         printf("%c(%d) ", dest[i], dest[i]);
  31.     }
  32.     printf("\n\n");
  33.     ft_strcpy(src + 1, src);
  34.     for (int i = 0; i <= strlen(src); i++)
  35.     {
  36.         printf("%c(%d) ", src[i], src[i]);
  37.     }
  38.     printf("\n");
  39.     for (int i = 0; i <= strlen(dest); i++)
  40.     {
  41.         printf("%c(%d) ", dest[i], dest[i]);
  42.     }
  43.     printf("\n\nDone!");
  44.  
  45.     return 0;
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement