Keil™, An ARM® Company

Cx51 User's Guide

static

The static storage class limits the scope of a variable and changes the lifetime of local variables. It is used as follows:

static data-type name « = value »;

Where

data-typeis the data type of the variable.
nameis the name of the variable.
valueis the value to assign to the variable.

When you use static to declare a variable outside a function, that variable cannot be accessed outside the source file in which it is declared.

When you use static to declare a variable inside a function, that variable is initialized at startup (like other global variables) and retains its value between calls to that function. It is not reinitialized on entry to the function.