Where are static variables stored (data segment or heap or BSS)?
问题 I obtained conflicting Opinions about static variable storage. Opinion 1 : "A stack static variable stores its value in the heap " Opinion 2 : "A stack static variable stores its value in the data segment". I am confused with these conflicting answers. Where exactly are static variables stored? I am expecting an answers with references (text books, authentic tutorials, etc.). Static variables have two types: static variables declared inside a function. global (declared outside function)