Memory allocation

Basic types / Pointers

#include <iostream>
using namespace std;

//pointer to int value
int *pInt = new int;
*pInt = 50;

//pointer to double
double *pDouble = new double;
double d = 3.14;
*pDouble = d;

cout << "*pInt is " << *pInt << endl;
cout << "*pDouble is " << *pDouble;

//Memory release: after delete the pointer must not be read
delete pInt;
delete pDouble;