C++ Dynamic allocation Full example
Example: C++ Dynamic allocation Full example
// rememb-o-matic
#include
#include
using namespace std;
int main ()
{
int i,n;
int * p;
cout << "How many numbers would you like to type? ";
cin >> i;
p= new (nothrow) int[i];
if (p == nullptr)
cout << "Error: memory could not be allocated";
else
{
for (n=0; n> p[n];
}
cout << "You have entered: ";
for (n=0; n