// from http://www.cplusplus.com/doc/tutorial/dynamic/ // rememb-o-matic #include #include using namespace std; void rnd(int* arr, int n); int main () { int i,n, q; cout<<"Main Process with pid : "<< getpid() << endl; int * p; cout << "How many numbers would you like to type? "; cin >> i; p= new int[i]; rnd(p, i); cout << "Remove from memory? 1(y)" << endl; cin >> q; if(q){ delete[] p; cout << "Removed" << endl; } cout << "Sleeping" << endl; usleep(20000000); return 0; } void rnd(int* arr, int n) { srand((unsigned)time(NULL)); for (int i = 0; i < n; i++) arr[i] = 1+ rand() % 4294967295; }