Guest User

Untitled

a guest
May 26th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.78 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. void *strcpy(char *src, char *dest);
  5. size_t strlen(char *tableau);
  6.  
  7. int main(int argc, char *argv[])
  8. {
  9.   char tableau[154] = "Salut";
  10.   char tableau_[154] = " ";
  11.   int taille;
  12.  
  13.   taille = strlen(tableau);
  14.  
  15.   fprintf(stdout, "\nLa taille de la chaine est de : %d\n", taille);
  16.  
  17.   strcpy(tableau, tableau_);
  18.  
  19.   fprintf(stdout, "tableau : %s\n", tableau);
  20.   fprintf(stdout, "tableau_ : %s\n", tableau_);
  21.   return 0;
  22. }
  23.  
  24. size_t strlen(char *tableau)
  25. {
  26.   int i;
  27.   int taille = 0;
  28.  
  29.   for(i = 0; i < sizeof(tableau); i++)
  30.     taille++;
  31.  
  32.   return taille;
  33. }
  34.  
  35. void *strcpy(char *src, char *dest)
  36. {
  37.   char i = 0;
  38.   char y = 0;
  39.  
  40.   while(i != '\0')
  41.     {
  42.       src[i] = dest[y];
  43.      
  44.       i++;
  45.       y++;
  46.     }
  47. }
Add Comment
Please, Sign In to add comment