By default all the data (int, float …) is stored on stack. The lifecycle of these variables are limited to the lifecycle of a function. After the function execution is complete, the variables are deleted from the memory and the system is free to allocate it to other variables/data. The data is stored in stack … Continue reading C++ Memory: Stack vs Heap