1#include <iostream>
2using namespace std;
3
4int main () {
5 double* pvalue = NULL; // Pointer initialized with null
6 pvalue = new double; // Request memory for the variable
7
8 *pvalue = 29494.99; // Store value at allocated address
9 cout << "Value of pvalue : " << *pvalue << endl;
10
11 delete pvalue; // free up the memory.
12
13 return 0;
14}
1#include <iostream>
2
3int main()
4{
5 int *ptr = new int;
6 *ptr = 4;
7 std::cout << *ptr << std::endl;
8 return 0;
9}
10