ssttaattiicc -- C Keyword

Declare storage class

ssttaattiicc  is a  C storage  class.   It has  two entirely  different meanings,
depending upon whether it appears inside or outside a function.

Outside a function, ssttaattiicc means  that the function or variable it preceeds
may not be seen outside the module.

Inside a function, static may only  precede a variable.  It means that that
variable is permanently allocated,  rather than allocated on the stack when
the function is entered and discarded when the function exits.  If a ssttaattiicc
variable is initialized, that  occurs before the program starts rather than
every time the  function is entered.  If a function  returns a pointer to a
variable, often that variable is declared ssttaattiicc within the function.  If a
pointer to a nnoonn-ssttaattiicc local  variable is returned, that variable is freed
when  the  function  returns  and  the  pointer points  to  an  unprotected
location.

_E_x_a_m_p_l_e
The  following example  demonstrates the  uses of  the ssttaattiicc  keyword.  It
returns the next integer in a sequence as a string.

/* static to keep function hidden outside of this module */
static char *nextInt()
{
    /* static to protect value between calls */
    static int next = 0;
    /* static to allow the return of a pointer to s */
    static char s[5];

    sprintf(s, "%d", next++);
    return(s);
}

_S_e_e _A_l_s_o
aauuttoo, CC kkeeyywwoorrddss, eexxtteerrnn, rreeggiisstteerr vvaarriiaabbllee, ssttoorraaggee ccllaassss
ANSI Standard, section 6.5.1
