MIPI_BaseC_WebinarFRTK/09_Lecture09/05_strcpy_p20.c

17 lines
333 B
C
Raw Permalink Normal View History

2024-11-13 09:22:28 +03:00
#include <stdio.h>
char *strcpy (char *dst, char *src)
{
char *ptr = dst;
while(*dst++=*src++);
return ptr;
}
int main(int argc, char **argv)
{
char str1[]={"Hello!"};//char* str1 = {"Hello!"};
char str2[]={"World!"};//char* str2={"World!"}
printf("%s\n",strcpy(str2,str1));
printf("%s\n",str2);
return 0;
}