c++静态变量与动态变量

为什么 三次打印 h 分别为 48 2 2

#include
using namespace std;
int total = 1;//静态存储区
    int f(int x)//动态存储区
    {
        int a =1, b =2;
        return x + a + b;
     } 
     int g();
     int main()
     {
     
         int a = 3;//动态存储区 
         {
             int b = 4;//动态存储区 
         }
         g();f(a);g();
         f(a);g();
         return 0;
     }
     int g()
    {
        static int times = 0;
        int y = 2;
        cout <<"times= " <<++times<static int temp;
        int h;
        cout <<"temp="<"h="<return 0;
    }

运气吧。h啥也没赋值就输出,只能靠运气

h完全没有初始化,也没有赋值,输出的数都是随机的