#include <iostream>
#include <cstdlib>
using namespace std;
int main() {
// allocate memory of int size to an int pointer
int* ptr = (int*) malloc(sizeof(int));
// assign the value 5 to allocated memory
*ptr = 5;
cout << *ptr;
return 0;
}
// Output: 5
int alloc_size = 10;
int* buffer = (int*) malloc (alloc_size);
//Allocate memory block which can fit 10 integers