Original Post
Hi, Lets say I have some code like this :- And Lets say I do the following :- A *a = Function(); Now I am allocation information to a local variable so would the content be lost once the function exits ? How exactly does this work considering "a" is just pointing to the information in "local structure "a" ." Just trying to understand how it works under the hood. Thanks
[Source]
struct A
{
....
};
A *Function()
{
A *a = new A;
....
....
return a;
}
[/Source]