1 #include <stdio.h>
 2 int main(void)
 3 {
 4     int i,o,p,h;
 5     printf("%d\n",i);
 6     printf("%d\n",o);
 7     printf("%d\n",p);
 8     printf("%d\n",h);
 9     getch();
10     return 0;
11 }

对于未初始化的变量,输出的是一个随即数,如下图:

1 编译器: Default compiler
2 执行  gcc.exe...
3 gcc.exe "D:\Documents\Desktop\main.c" -o "D:\Documents\Desktop\main.exe"   -g3  -I"d:\c\DEV-CPP\include"   -L"d:\c\DEV-CPP\Lib" -g3 
4 执行结束
5 成功编译

C语言未初始化变量输出的是随即数

 

具体的默认值与你的编译器有关。

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-11
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-09-05
  • 2022-03-08
  • 2021-08-30
  • 2021-10-06
  • 2021-10-07
  • 2022-12-23
相关资源
相似解决方案