有一字符串,包含n个字符。写一函数,将此字符串中从第m个字符开始的全部字符复制成为另一字符串。
#include #include #include int str(char *str1,char *str2,int n,int m) {char *p; p=&str1[m-1];//m>n,直接返回空串 if(m>n){str2[0]='\\0';return 1; } do{*str2++=*p++;}while(*p!='\\0'); *str2='\\0'; return 1; } int main() {char a[9]=\"abcdefsf\ printf(\"%s\\n\ return 0; } 因篇幅问题不能全部显示,请点此查看更多更全内容
Copyright © 2019- howto234.com 版权所有 湘ICP备2022005869号-3
违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务