Golden rule:
Never return the address of an automatic local variable from a function
Never return a reference to automatic local variable from a function

any one please me some example

int* func1(){
int* p;
int i = 20;
p = &i;
return p;
}

the example above is correct !!
why ? p is store address of i (whice i is local variable)
i understand allright or not ?
please give easy example
i am new in C++