Why does the C standard leave use of indeterminate variables undefined?

前端 未结 5 1600
栀梦
栀梦 2020-12-06 06:40

Where are the garbage value stored, and for what purpose?

5条回答
  •  一生所求
    2020-12-06 07:14

    Why does the C standard leave use of indeterminate variables undefined?

    It does not :-) :

    • for local variables, it says undefined behavior, which means that anything (e.g. segfault, erasing your hard disk) is legal: (Why) is using an uninitialized variable undefined behavior?

    • for global variables, it zeros them: What happens to a declared, uninitialized variable in C? Does it have a value?

提交回复
热议问题