Do I need to free the ptr
? If so, how?
#include <iostream>
using namespace std;
void printFromPtr(int *ptr);
int main()
{
int a = 3;
int numPrint = 10000;
for (int i = 0; i < numPrint; i++)
{
printFromPtr(&a);
}
}
void printFromPtr(int* ptr)
{
cout << *ptr << endl;
}