float b3, b4;
char c3, c4;
printf("全局变量:a1 = %d, a2 = %d, b1 = %f, b2 = %f, c1 =%d, c2 =%d\n", a1,...a2, b1, b2, c1, c2);
printf("局部变量:a3 = %d, a4 = %d, b3 = %f, b4 = %f, c3 =%d, c4 =%d\n", a3, a4, b3..., b4, c3, c4);
return 0;
}
程序运行结果为:
全局变量:a1 = 0, a2 = 0, b1 = 0.000000, b2 = 0.000000, c1 =0, c2 =0...局部变量:a3 = 4200660, a4 = 4200754, b3 = 0.000000, b4 = 0.000000, c3 =0, c4 =0
可见,全局变量的默认初值为0。...局部变量的默认是随机的,没有规律的。所以,我们在使用局部变量之前应该首先进行初始化,否则可能会出现意想不到的错误。
----