运行以下代码后出现分段错误:
int main(){
const char *string = "This is not reverse";
char *reverse;
char temp;
int length, i = 0;
length = strlen(string);
strcpy(reverse, string);
while(i < (length/2)){
temp = *(reverse+i); // this is the reason for segmentation fault..but why?
i++;
}
}
有人可以解释一下原因吗