0

Possible Duplicate:
Static variable initialization?

why global variable in C takes zero as initial value?

Community
  • 1
  • 1
vivek
  • 11
  • 1
  • 1

1 Answers1

0

This required for a compiler to conform to the C standard.

The reason for the design choice is likely that having random garbage in your uninitialized variables makes errors much harder to detect.

Borealid
  • 95,191
  • 9
  • 106
  • 122