Global variables can be in a couple places, depending on how they're set up - for example, const
globals may be in a read-only section of the executable. "Normal" globals are in a read-write section of the executable. They're not on the heap or the stack at all. Pointers are just a type of variable, so they can be wherever you want them to be (on the heap if you malloc()
them, on the stack if they're local variables, or in the data section if they're global).
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…