Hello I have a class with a function that returns a pointer:
int* Maze::GetStart()
{
int startNode = 1;
return &startNode;
}
Will the value of startNode be erased after the function returns the pointer?
If I did this instead would the value be saved?
int Maze::GetStart()
{
int startNode = 1;
return startNode ;
}
main
{
int* pStart = maze.GetStart();
}