Pointers allow programs to dynamically allocate memory during runtime. There are two types of memory allocation: static and dynamic. Static allocation is done by the compiler at compile time, for variables declared within a function or globally. Dynamic allocation occurs at runtime using pointers, returning unnamed memory on the heap that is referenced indirectly. Pointers can either be constant pointers, where the pointer value cannot change but the referenced object can, or pointers to constant, where the pointer can change but the referenced object cannot.