Is there any problem in following code? int *p= new int[10]; delete p;
Is there any problem of bellow code piece?
//代码1
int A() {
int test=10;
return test;
}
int main() {
int a=A();
printf("%d\n",a);
return 0;
}
//代码2
char* A() {
char p[]="hello world";
return p;
}
int main() {
char *str=NULL;
str=A();
printf("%s",str);
}