c语言的字符串拷贝函数的精简
#include <stdio.h>
#include <string.h>
void str_cpy(char * to, char *from)
{
while ((*to++ = *from++) != '\0');
return;
}
int main()
{
char a[128];
str_cpy(a,"hello");
printf("a:%s\n",a);
return 0;
}
啦啦啦!!!
#include <stdio.h>
#include <string.h>
void str_cpy(char * to, char *from)
{
while ((*to++ = *from++) != '\0');
return;
}
int main()
{
char a[128];
str_cpy(a,"hello");
printf("a:%s\n",a);
return 0;
}