I was writing a program and facing this problem that the following function used to return garbage values:
int* foo(int temp){
int x = temp;
return &x;
}
When I modified it to this, it worked fine:
int* foo(int *temp){
int *x = temp;
return x
}
What was wrong with the first version?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…