当前位置:网站首页>6-5 string - 2 String copy (assignment) (10 points) the C language standard function library includes the strcpy function for string copy (assignment). As an exercise, we write a function with the sam
6-5 string - 2 String copy (assignment) (10 points) the C language standard function library includes the strcpy function for string copy (assignment). As an exercise, we write a function with the sam
2022-04-23 20:27:00 【Tomatos_ baby】
C The language standard function library includes strcpy function , For string copying ( assignment ). As a practice , We write a function with the same function .
The function prototype
char* StrCpy(char *dst, const char *src);
explain :src Is the starting address of the source string ,dst The starting address of the string for the purpose , Function will src Copy string to dst strand , Function value is dst.
judging procedures
#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;
}
/* The code you submit will be embedded here */
sample input
abcd
sample output
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://yzsam.com/2022/04/202204232022015387.html
边栏推荐
- The market share of the financial industry exceeds 50%, and zdns has built a solid foundation for the financial technology network
- Install MySQL 5.0 under Linux 64bit 6 - the root password cannot be modified
- Three. Based on ply format point cloud voxel model JS upload interface writing
- [latex] 5 how to quickly write out the latex formula corresponding to the formula
- ArcGIS JS version military landmark drawing (dovetail arrow, pincer arrow, assembly area) fan and other custom graphics
- The R language uses the timeroc package to calculate the multi time AUC value of survival data without competitive risk, and uses the confint function to calculate the confidence interval value of mul
- How to protect ECs from hacker attacks?
- Installation and use of NVM
- LeetCode 709、转换成小写字母
- 【问题解决】‘ascii‘ codec can‘t encode characters in position xx-xx: ordinal not in range(128)
猜你喜欢

上海回應“面粉官網是非法網站”:疏於運維被“黑”,警方已立案

【PTA】整除光棍
![[PTA] l1-002 printing hourglass](/img/9e/dc715f7debf7edb7a40e9ecfa69cef.png)
[PTA] l1-002 printing hourglass

JS arrow function user and processing method of converting arrow function into ordinary function
ArcGIS JS version military landmark drawing (dovetail arrow, pincer arrow, assembly area) fan and other custom graphics

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

Shanghai a répondu que « le site officiel de la farine est illégal »: l'exploitation et l'entretien négligents ont été « noirs » et la police a déposé une plainte

How to protect ECs from hacker attacks?

Commit and ROLLBACK in DCL of 16mysql

Sqoop imports tinyint type fields to boolean type
随机推荐
LeetCode 74、搜索二维矩阵
Browser - learning notes
Es keyword sorting error reason = fielddata is disabled on text fields by default Set fielddata = true on keyword in order
論文寫作 19: 會議論文與期刊論文的區別
Recognition of high-speed road signs by Matlab using alexnet
Devaxpress report replay: complete the drawing of conventional two-dimensional report + histogram + pie chart
Numpy mathematical function & logical function
R language uses timeroc package to calculate the multi time AUC value of survival data under competitive risk, uses Cox model and adds covariates, and R language uses the plotauccurve function of time
DNS cloud school | analysis of hidden tunnel attacks in the hidden corner of DNS
WordPress plug-in: WP CHINA Yes solution to slow domestic access to the official website
SQL Server Connectors By Thread Pool | DTSQLServerTP plugin instructions
Servlet learning notes
Some basic configurations in interlij idea
Scripy tutorial - (2) write a simple crawler
论文写作 19: 会议论文与期刊论文的区别
Introduction to link database function of cadence OrCAD capture CIS replacement components, graphic tutorial and video demonstration
2022DASCTF Apr X FATE 防疫挑战赛 CRYPTO easy_real
Latest investigation and progress of building intelligence based on sati
內網滲透之DOS命令
Livego + ffmpeg + RTMP + flvjs to realize live video