static variables in Objective-C - what do they do?

后端 未结 3 1132
旧巷少年郎
旧巷少年郎 2020-12-07 08:46

I\'ve seen a few posts discussing what a static variable is and I think I get it - but I\'d love to quickly write (or find) a program that utilizes both a regular and a stat

3条回答
  •  日久生厌
    2020-12-07 09:38

    static works mostly like in C.

    1. It can either initialize a variable only once.

    2. Declaring a variable static in a file above @implementationblock will be available for the whole file only.

提交回复
热议问题