Advertisement
any15015

Prog2tp2Ej1(strcpy)

Mar 25th, 2024
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.43 KB | None | 0 0
  1.  
  2. #include<iostream>
  3. #include <locale>
  4. #include<string.h>
  5. using namespace std;
  6.  
  7. void copiar_D_en_C(char c[], char d[]);
  8.  
  9. int main(void)
  10. {
  11.     setlocale(LC_ALL, "Spanish");
  12.     char c[20]="buenas", d[20]="que tal";
  13.     copiar_D_en_C(c, d);
  14.     cout << "contenido de c: " << c << endl;
  15.  
  16.     return 0;
  17. }
  18.  
  19. void copiar_D_en_C(char c[], char d[]){
  20.     int i=0;
  21.     while(d[i]!='\0'){
  22.         *(c+i)= *(d+i);
  23.         i++;
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement