【发布时间】:2022-01-11 04:43:39
【问题描述】:
我收到以下错误:
线程 1 收到信号 SIGSEGV,分段错误
代码如下:
int extraercadena(char *cad, char *tCad, int ini, int fin){
int iC, iS;
if ((ini>fin) || (ini < 0) || (fin >= strlen(cad)))
return 0;
iS = 0;
for(iC = ini; iC <= fin; iC++){
//error is here, the system halt here
tCad[iS] = cad[iC];
iS++;
}
tCad[iS] = '\0';
return 1;
}
【问题讨论】: