For example:
void func1(){
int i = 123;
func2(&i);
}
void func2(int *a){
*a = 456;
}
When func1
calling func2
, a pointer to local variable is passed to func2
-- the pointer is pointed to the stack. Is this safe for the rules of C?
Thanks.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…