Функция put в my_strcpy () также должна печатать в соответствии со мной, но почему она не печатается, я не могу понять.
#include<stdio.h>
#include<iostream.h>
void my_strcpy(char *source,char *destination);
int main()
{
char strA[]="\nMy Name is Jagdeep\n";
char strB[30];
char *pA,*pB;
pA=strA;
pB=strB;
my_strcpy(pA,pB);
puts(pA);
//puts(strB);
return 0;
}
//function to copy strings
void my_strcpy(char *source,char *destination)
{
while(*source!='\0')
{
*destination++=*source++;
}
*destination='\0';
cout<<"\t You are in str_mycopy";
puts(destination);
}
Вывод вышеприведенного кода:
You are in strmycopy
My Name is Jagdeep