当前位置:网站首页>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 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
- BMP JPEG picture to vector image contourtrace
- How do BIM swindlers cheat? (turn)
- R language uses econocrats package to create microeconomic or macroeconomic map, visualize indifference function indifference curve, customize calculation intersection, and customize the parameters of
- Tensorflow 2 basic operation dictionary
- 16MySQL之DCL 中 COMMIT和ROllBACK
- Experience of mathematical modeling in 18 year research competition
- Research on open source OCR engine
- Notes of Tang Shu's grammar class in postgraduate entrance examination English
- Error reported by Azkaban: Azkaban jobExecutor. utils. process. ProcessFailureException: Process exited with code 64
猜你喜欢
Notes of Tang Shu's grammar class in postgraduate entrance examination English
上海回应“面粉官网是非法网站”:疏于运维被“黑”,警方已立案
LeetCode 74、搜索二维矩阵
JS arrow function user and processing method of converting arrow function into ordinary function
What is the difference between a host and a server?
Es keyword sorting error reason = fielddata is disabled on text fields by default Set fielddata = true on keyword in order
[latex] 5 how to quickly write out the latex formula corresponding to the formula
CVPR 2022 | querydet: use cascaded sparse query to accelerate small target detection under high resolution
Handwritten Google's first generation distributed computing framework MapReduce
After route link navigation, the sub page does not display the navigation style problem
随机推荐
考研英语唐叔的语法课笔记
Historical track data reading of Holux m1200-e Bluetooth GPS track recorder
What is the difference between a host and a server?
[PTA] l1-006 continuity factor
Matlab analytic hierarchy process to quickly calculate the weight
論文寫作 19: 會議論文與期刊論文的區別
Development of Matlab GUI bridge auxiliary Designer (functional introduction)
[latex] 5 how to quickly write out the latex formula corresponding to the formula
Change the material of unity model as a whole
Don't bother tensorflow learning notes (10-12) -- Constructing a simple neural network and its visualization
6-5 字符串 - 2. 字符串复制(赋值) (10 分)C语言标准函数库中包括 strcpy 函数,用于字符串复制(赋值)。作为练习,我们自己编写一个功能与之相同的函数。
SQL gets the latest record of the data table
Thirty What are VM and VC?
【栈和队列专题】—— 滑动窗口
Mysql database backup scheme
Plato farm is one of the four largest online IEOS in metauniverse, and the transaction on the chain is quite high
Introduction to link database function of cadence OrCAD capture CIS replacement components, graphic tutorial and video demonstration
Modeling based on catiav6
Investigate why close is required after sqlsession is used in mybatties
Implementation of mypromise