为什么这条线会导致段错误?根据我对指针以及调试器输出的了解,分配应该可以工作。
int delimChar(char **in ){ //in is a pointer to a pointer to the start of a
char del = '|'; // string with atleast two | characters
while (**in!=del){
(*in)++;
}
(*in)++;
char *temp = *in;
while(9001){
(*in)++;
if (**in == del){
break;
}
}
**in = '\0'; //This line causes a segfault, even though **in shows as
*in = temp; // '|' in debug output
return 0;
}