#include // For malloc() #include int main () { // Points to an integer, right now points to nothing int *a = NULL; a = malloc(sizeof(int)); // Allocate sizeof(int) bytes, 4 bytes on most machines // Right now *a (what a points to) contains uninitialized data printf ("%d\n", *a); // Assign something to the memory we allocated *a = 10; printf ("%d\n", *a); // When you're through with your memory, deallocate it // and assign NULL to the pointer // If you forget to deallocate it, it's called a memory leak // Also, remember not to call free() on anything that wasn't // returned by malloc() free(a); a = NULL; return 0; }