1.2k views
1 vote
Block scope, uninitialized, non-static C variables are stored where?

1) Stack memory
2) Heap memory
3) Global memory
4) Cannot be determined

1 Answer

1 vote

Final answer:

Uninitialized, non-static C variables with block scope are stored in the stack memory. The stack is used to store local variables and function call information. Dynamically allocated memory is stored in the heap memory.

Step-by-step explanation:

Uninitialized, non-static C variables with block scope are stored in the stack memory.

The stack is a region of memory that is used to store local variables and function call information. When a function is called, its local variables are pushed onto the stack, and when the function returns, the stack is popped and the variables are removed.

In contrast, dynamically allocated memory (using malloc or new) is stored in the heap memory. Global variables have their own region of memory called the global memory.

User Nanuqcz
by
8.2k points