Ans- The different memory areas available to the programmer are-
a)Stack b)Heap c)Global/static d)Code(Text)
a)Stack-- It's a special region of our computer's memory that stores temporary variables created by each function (including the main() function). The stack is a "LIFO" (last in, first out)or "FILO"(First In Last Out). data structure, that is managed and optimized by the CPU quite closely. Every time a function declares a new variable, it is "pushed" onto the stack. Then every time a function exits, all of the variables pushed …show more content…
Once a stack variable is freed, that region of memory becomes available for other stack variables. The advantage of using the stack to store variables, is that memory is managed for us.We don't have to allocate memory by hand, or free it once we don't need it any more. What's more, because the CPU organizes stack memory so efficiently, reading from and writing to stack variables is very fast.A key to understanding the stack is the notion that when a function exits, all of its variables are popped off of the stack (and hence lost forever). Thus stack variables are local in nature. This is related to a concept known as variable scope, or local vs global