There's a function which returns a pointer(any type), if I don't store the pointer when I call the function, what happens? Will the function still return a pointer in this case? If yes, then will there be a memory leak because I'm not freeing up the allocated memory?
Consider the below code as an example:
int * testfunc()
{
int * a=new int();
return(a);
}
int main()
{
testfunc();
return(0);
}