Initializing variables in C

后端 未结 10 704
长情又很酷
长情又很酷 2020-12-02 12:21

I know that sometimes if you don\'t initialize an int, you will get a random number if you print the integer.

But initializing everything to zero seems

10条回答
  •  长情又很酷
    2020-12-02 13:08

    As long as I have not read from a variable before writing to it, I have not had to bother with initializing it.

    Reading before writing can cause serious and hard to catch bugs. I think this class of bugs is notorious enough to gain a mention in the popular SICP lecture videos.

提交回复
热议问题