I got conflicting opinions about the storage of static variables.
Opinion 1: Static variable < retains its value in the heap "
Opinion 2: "Static variable < retains its value in the data segment. "
I am confused by these conflicting answers.
Where are the static variables stored?
I expect answers with links (tutorials, genuine tutorials, etc.).
Static variables have two types:
- static variables declared inside a function.
- global (declared external function) static variable.
I would also like to know if there is a difference in storing these two types of variables?
source
share