Generally, the best way to allocate memory is by using the malloc() and free() functions. You can allocate memory by assigning a variable address, but this a more inflexible method, and can lead to unpredictable behavior because there’s no explicit lifetime for the memory access.