What does vb6 initialize a static Integer to?

前端 未结 2 976
死守一世寂寞
死守一世寂寞 2021-01-27 02:46
Static i as integer

What will i be before I assign a value.

It seems to be just zero (0) but I wanted to confirm that.

相关标签:
2条回答
  • 2021-01-27 03:09

    According to Microsoft

    Normally in Visual Basic, when a static variable is declared inside a Function or Sub procedure, it gets initialized to 0 (numeric data type) or an empty string, "" (string data type), by default.

    So yeah, you can be sure it's default value is zero.

    Hope this helps

    0 讨论(0)
  • 2021-01-27 03:10

    Variables of all VB data types receive their respective default value when the procedure starts.

    This includes initializing all numbers to zero, and all the other data types to their flavour of zero (vbNullString for strings, not exactly the same as an empty string "", False for booleans, Empty for variants, and Nothing for objects).

    0 讨论(0)
提交回复
热议问题