当前位置:网站首页>习题8-5 使用函数实现字符串部分复制 (20 分)
习题8-5 使用函数实现字符串部分复制 (20 分)
2022-06-11 22:18:00 【小言同学Y】
本题要求编写函数,将输入字符串t中从第m个字符开始的全部字符复制到字符串s中。
函数接口定义:
void strmcpy( char *t, int m, char *s );
函数strmcpy将输入字符串char *t中从第m个字符开始的全部字符复制到字符串char *s中。若m超过输入字符串的长度,则结果字符串应为空串。
裁判测试程序样例:
#include <stdio.h>
#define MAXN 20void strmcpy( char *t, int m, char *s );
void ReadString( char s[] ); /* 由裁判实现,略去不表 */int main()
{
char t[MAXN], s[MAXN];
int m;scanf("%d\n", &m);
ReadString(t);
strmcpy( t, m, s );
printf("%s\n", s);return 0;
}/* 你的代码将被嵌在这里 */
输入样例:
7
happy new year
输出样例:
new year
void strmcpy( char *t, int m, char *s ){
int i;
for(i=0;i<strlen(t);i++){
s[i]=t[m-1];
m++;
}
}
边栏推荐
- Basic operation and question type summary of linked list
- Collection of articles and literatures related to R language (continuously updated)
- 图的基本操作(C语言)
- 【学术相关】申请审核制下,到双一流大学读博的难度有多大?
- 剑指offer数组题型总结篇
- 向线程池提交任务
- Daily question - Roman numeral to integer
- R7-1 列表或元组的数字元素求和
- Custom implementation offsetof
- Non recursive writing of quick sort
猜你喜欢

Superscalar processor design yaoyongbin Chapter 2 cache -- Excerpt from subsection 2.3

Players must read starfish NFT advanced introduction

Nmap performs analysis of all network segment IP survivals in host detection
![[today in history] June 11: the co inventor of Monte Carlo method was born; Google launched Google Earth; Google acquires waze](/img/eb/147d4aac20639d50b204dcf424c9e2.png)
[today in history] June 11: the co inventor of Monte Carlo method was born; Google launched Google Earth; Google acquires waze
![[niuke.com] dp31 [template] complete Backpack](/img/81/5f35a58c48f05a5b4b6bdc106f5da0.jpg)
[niuke.com] dp31 [template] complete Backpack

详解异步任务:函数计算的任务触发去重

Implementation stack and queue

R语言书籍学习03 《深入浅出R语言数据分析》-第八章 逻辑回归模型 第九章 聚类模型

移动端——swipe特效之图片时间轴

Optimization of quick sort
随机推荐
[today in history] June 11: the co inventor of Monte Carlo method was born; Google launched Google Earth; Google acquires waze
R language book learning 03 "in simple terms R language data analysis" - Chapter 10 association rules Chapter 11 random forest
360 online enterprise security cloud is open to small, medium and micro enterprises for free
Non recursive writing of quick sort
超標量處理器設計 姚永斌 第2章 Cache --2.4 小節摘錄
STM32开发笔记112:ADS1258驱动设计——读寄存器
Unity3D getLaunchIntentForPackage 获取包返回null问题
The college entrance examination is over, and life has just begun. Suggestions from a 10-year veteran in the workplace
Basic operation and question type summary of linked list
Inner join execution plan changed
leetcode 257. Binary tree paths all paths to a binary tree (simple)
3.2 测试类的命名规则
Superscalar processor design yaoyongbin Chapter 2 cache -- Excerpt from subsection 2.4
Go IO module
[uniapp native plug-in] shangmi cashbox plug-in
Win10弹出USB时出现该设备正在使用的解决方法
C language implements eight sorts (3)
3.3 测试模块的命名规则
Static PVC with CEPH CSI
超标量处理器设计 姚永斌 第2章 Cache --2.4 小节摘录