A
africamp
Lets say I have a program:
#include <iostream>
#include <conio.h>
using namespace std;
int* ptest();
int main()
{
int* b = ptest();
getch();
return 0;
}
int* ptest()
{
int num = 5;
int* intp = new int(num);
return intp;
}
Is there any way to free the memory that was allocated for the variable
intp outside of the function, ptest()? Thanks
#include <iostream>
#include <conio.h>
using namespace std;
int* ptest();
int main()
{
int* b = ptest();
getch();
return 0;
}
int* ptest()
{
int num = 5;
int* intp = new int(num);
return intp;
}
Is there any way to free the memory that was allocated for the variable
intp outside of the function, ptest()? Thanks