The stack and the heap
Local variables live on the stack and vanish when their function returns. malloc gives you heap memory that stays until you free it.
Premium
Inside: an interactive visualisation, 2 short explanations, a runnable example and 1 checked exercise.
See Premium£7.99 a month. Already Premium? Sign in