# Include <iostream> # include <windows. h> int * Fun (int * A) {STD: cout <* A <STD: Endl; // is there a problem ???? Int temp = 100; Return & temp; // This is a typical error} int main () {int A = 9; int * temp = fun (& ); // pass & A. Will this address expire in fun? Fun is still in another scope. I am afraid that the memory on this stack is invalid STD: cout <* temp <"\ t" <* temp; getchar (); return 0;} 1. first, the address of the local variable will not expire before the function exits. Therefore, the address of a will not expire when you call fun. from the stack perspective, we should first set up the main stack, press a on the stack, and then create the stack for fun. At this time, the main stack is okay, so there is no problem with access, and then fun returns, and fun's stack is destroyed, there is no problem with main. When main returns, the stack of main will also be gone, but this stack does not seem to have much to do with the stack on the data structure.