Because the initialisation can be (and probably is) done at compile time or at worst at load time. Global values are not found on the stack, but in the global data section (which is a segment in assembly and later on in machine code). Same goes for static variables because all static variables share the same address which makes them "global" (or better said unique).
A difference between static and global variables is that globals are accessible from "outside" (outside a function) while static variables can be accessed from "outside" and "inside" (inside a function).
For instance, this code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#include <iostream>
int a;
int func(int b){
staticint c;
std::cout << "c is: " << c << std::endl;
c = b;
return c;
}
int main()
{
std::cout << a << std::endl;
std::cout << "func() is: " << func(10) << std::endl;
func(100);
return 0;
}