What are static variables?

前端 未结 3 443
南方客
南方客 2020-12-14 23:56

What are static variables designed for? What\'s the difference between static int and int?

3条回答
  •  难免孤独
    2020-12-15 00:32

    Static variables are initialized in the data segment (on x86; modify as appropriate for other architectures) instead of on the stack. They persist for the life of the program instead of vaporizing once they go out of scope.

提交回复
热议问题