#include <stdio.h>
#include <stdlib.h>
int main() {
// Ask for enough memory to hold one int
int *ptr = malloc(sizeof(int));
if (ptr == NULL) {
printf("Memory request failed.\n");
return 1;
}
*ptr = 42; // store a value in that memory
printf("Value: %d\n", *ptr);
free(ptr); // give the memory back
return 0;
}