今天小编给大家带来的是c语言怎样截取字符串,希望能帮助到大家!
操作方法
01
直接给大家代码吧:#include
02
for(i=n-1;i 03 题目要调用这个函数:viod substr(char *source,int start,intlength,char *dest);//cscs.cpp:Definestheentrypointfortheconsoleapplication.//#include"stdafx.h"#include 04 chara[20],b[20],*p;intn,x,i;printf("howlong:");scanf("%d",&n);printf("where:");scanf("%d",&x);getchar();printf("inputwords:");gets(a);p=a;substr(p,x,n,b);return0;} 05 voidsubstr(char*source,intstart,intlength,char*dest){intk;inti;intj=0;char*p;k=strlen(source);p=source;for(i=start-1;i