当前位置:网站首页>6-5 字符串 - 2. 字符串复制(赋值) (10 分)C语言标准函数库中包括 strcpy 函数,用于字符串复制(赋值)。作为练习,我们自己编写一个功能与之相同的函数。
6-5 字符串 - 2. 字符串复制(赋值) (10 分)C语言标准函数库中包括 strcpy 函数,用于字符串复制(赋值)。作为练习,我们自己编写一个功能与之相同的函数。
2022-04-23 20:22:00 【Tomatos_baby】
C语言标准函数库中包括 strcpy 函数,用于字符串复制(赋值)。作为练习,我们自己编写一个功能与之相同的函数。
函数原型
char* StrCpy(char *dst, const char *src);
说明:src 为源串的起始地址,dst 为目的串起始地址,函数将 src 串复制到 dst 串,函数值为 dst。
裁判程序
#include <stdio.h>
#include <string.h>
char* StrCpy(char *dst, const char *src);
int main()
{
char a[1024], b[1024], c[1024];
gets(a);
StrCpy(c, StrCpy(b, a));
puts(a);
puts(b);
puts(c);
return 0;
}
/* 你提交的代码将被嵌在这里 */
输入样例
abcd
输出样例
abcd
abcd
abcd
char* StrCpy(char *dst, const char *src)
{
int i,j;
for(i=0,j=0;src[i]!='\0';i++)
{
dst[j]=src[i];
j++;
}
dst[j]='\0';
return dst;
}
版权声明
本文为[Tomatos_baby]所创,转载请带上原文链接,感谢
https://blog.csdn.net/Tomatos_baby/article/details/124344227
边栏推荐
- Error reported by Azkaban: Azkaban jobExecutor. utils. process. ProcessFailureException: Process exited with code 127
- BMP JPEG 图片转换为矢量图像 ContourTrace
- Remote code execution in Win 11 using wpad / PAC and JScript 1
- Recommend an open source free drawing software draw IO exportable vector graph
- R language survival package coxph function to build Cox regression model, ggrisk package ggrisk function and two_ Scatter function visualizes the risk score map of Cox regression, interprets the risk
- star
- CVPR 2022 | querydet: use cascaded sparse query to accelerate small target detection under high resolution
- Linux64Bit下安装MySQL5.6-不能修改root密码
- Latest investigation and progress of building intelligence based on sati
- Record: call mapper to report null pointer Foreach > the usage of not removing repetition;
猜你喜欢

How to protect ECs from hacker attacks?

Matlab analytic hierarchy process to quickly calculate the weight

Customize timeline component styles

Browser - learning notes

堡垒机、跳板机JumpServer的搭建,以及使用,图文详细

RT-1052学习笔记 - GPIO架构分析

16MySQL之DCL 中 COMMIT和ROllBACK
![Azkaban recompile, solve: could not connect to SMTP host: SMTP 163.com, port: 465 [January 10, 2022]](/img/1a/669c330e64af8e75f4b05e472d03d3.png)
Azkaban recompile, solve: could not connect to SMTP host: SMTP 163.com, port: 465 [January 10, 2022]

Identification of bolt points in aerial photography based on perception

BMP JPEG 图片转换为矢量图像 ContourTrace
随机推荐
CVPR 2022 | querydet: use cascaded sparse query to accelerate small target detection under high resolution
NC basic usage 1
ArcGIS JS version military landmark drawing (dovetail arrow, pincer arrow, assembly area) fan and other custom graphics
Numpy Index & slice & iteration
Rédaction de thèses 19: différences entre les thèses de conférence et les thèses périodiques
WordPress plug-in: WP CHINA Yes solution to slow domestic access to the official website
【栈和队列专题】—— 滑动窗口
NC basic usage 4
LeetCode动态规划训练营(1~5天)
[talkative cloud native] load balancing - the passenger flow of small restaurants has increased
三十一. `prototype`显示原型属性和`__proto__`隐式原型属性
ABAQUS script email auto notification
Latest investigation and progress of building intelligence based on sati
. Ren -- the intimate artifact in the field of vertical Recruitment!
R语言ggplot2可视化:ggplot2可视化散点图并使用geom_mark_ellipse函数在数据簇或数据分组的数据点周围添加椭圆进行注释
【PTA】整除光棍
Zdns was invited to attend the annual conference of Tencent cloud basic resources and share the 2020 domain name industry development report
Redis installation (centos7 command line installation)
Servlet learning notes
Cadence Orcad Capture CIS更换元器件之Link Database 功能介绍图文教程及视频演示