#include <stdio.h>
void stringCopy(char *source, char *destination) {
while (*source) {
*destination = *source;
source++;
destination++;
}
*destination = '\0';
}
int main() {
char source[] = "Hello, World!";
char destination[50];
stringCopy(source, destination);
printf("源字符串:%s\n", source);
printf("复制后的字符串:%s\n", destination);
return 0;
}
C语言:调用自定义函数实现字符串复制功能。
本文详细介绍了如何在C语言中使用stringCopy函数实现字符串复制,包括函数定义、参数和main函数中的应用实例。
摘要由CSDN通过智能技术生成