c语言怎样截取字符串
1、直接给大家代码吧:#include<stdio.h>#include<string.h>#include<ctype.h>voidprint(chars[],intn,intm){intk;inti;char*p;k=strlen(s);p=s;

3、题目要调用这个函数:viod substr(char *source,int start,intle荏鱿胫协ngth,char *dest);//cscs.cpp:Definestheentrypointfortheconsoleapplication.//#include"stdafx.h"#include<stdio.h>#include<string.h>#include<ctype.h>voidsubstr(char*source,intstart,intlength,char*dest);intmain(){

5、voidsubstr(char*source,intstart,intlength,char*dest){intk;inti;intj=0;char*p;k=strlen(source);p=source;for(i=start-1;i<start-1+length;i++)//从第n-1位置开始,截取m个字符dest[j++]=*(p+i);dest[j]='\0';printf("thenewstringis:");puts(dest);printf("\n");}

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
阅读量:43
阅读量:69
阅读量:82
阅读量:60
阅读量:37