下面代码片段中有哪些隐患或者错误 void *get1(){ ...
下面代码片段中有哪些隐患或者错误
void *get1(){
char buf[12] = {"abc"}
return buf
}
void get2(int *p){
p = new int[10]
}
int main(){
int *m
get2(m)
m = get1()
memcpy(m, "aaa", 3)
return 0
}
下面代码片段中有哪些隐患或者错误
void *get1(){
char buf[12] = {"abc"}
return buf
}
void get2(int *p){
p = new int[10]
}
int main(){
int *m
get2(m)
m = get1()
memcpy(m, "aaa", 3)
return 0
}