为什么下面的例子不正确?为什么它不显示一个悬空指针?我的老师说它没有显示悬空指针。提前致谢!
int X = 32;
int *p = &X;
free(p);
*p = 32; //<------Shouldn't this line cause dangling pointer ???
这里也一样。为什么以下示例不演示内存泄漏?
void function(int x){
int *p = &x;
*p = 32;
//shouln't this code show a warning as p was not freed?
}