Vasilena

PracticeDayFiveExercise3

Jul 9th, 2021 (edited)
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.35 KB | None | 0 0
  1. void Copy(char* destination,const char* source)
  2. {
  3.     char* p = destination;
  4.     while(*source)
  5.     {
  6.         *p = *source;
  7.         p++;
  8.         source++;
  9.     }
  10.     p = '\0';
  11. }
  12.  
  13. int main()
  14. {
  15.   char str1[100];
  16.   char str2[100];
  17.   printf("Enter first string: ");
  18.   gets(str1);
  19.   Copy(str2, str1);
  20.   printf("String 2: %s", str2);
  21.   return 0;
  22. }
  23.  
Add Comment
Please, Sign In to add comment