/* 有一字符串,包含n个字符。 写一函数,将此字符串中 从第m个字符开始的全部字符复制成为另一个字符串 */ #include<stdio.h> #include<string.h> int main(){ char buf1[1024],buf2[1024]; printf("plase enter a string:\n"); scanf("%s",buf1); int m; scanf("%d",&m); if(m<0||m>strlen(buf1)){ printf("Illegal location entered\n"); return -1; } char *prt1 = buf1 + m; char *prt2 = buf2; while(*prt1 != '\0'){ *prt2++ = *prt1++; } *prt2 = '\0'; printf("%s\n",buf2); return 0; }
0.0分
0 人评分
1025题解浏览:732 |
C语言训练-自守数问题 (C语言代码)浏览:739 |
汽水瓶 (C语言代码)浏览:530 |
统计立方数 (C语言代码)浏览:862 |
判定字符位置 (C++代码)浏览:666 |
三角形 (C语言代码)浏览:653 |
蛇行矩阵 (Java代码)浏览:661 |
Manchester- A+B for Input-Output Practice (VII)浏览:1008 |
单词替换浏览:1196 |
Manchester- 陶陶摘苹果浏览:4054 |