This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

why and when to use Static Function

Dear friend,
can anybody explain me
why this kind of Static function used and when it should be used?

static void delay (unsigned long cnt)
{ while (cnt--);
}

Parents
  • First of all, please read the instructions on how to post source code:
    www.danlhenry.com/.../keil_code.png

    Did you not notice in the preview that the presentation had gone wrong?
    Didn't you expect to see:

    static void delay( unsigned long cnt )
    {
       while( cnt-- );
    }
    

    Note that 'static' is a standard 'C' keyword that has nothing specifically to do Keil, nor ARM, nor with "this kind of function".

    You can look up the meaning of the 'static' keyword in any good 'C' textbook...

    See also: http://c-faq.com/index.html

Reply
  • First of all, please read the instructions on how to post source code:
    www.danlhenry.com/.../keil_code.png

    Did you not notice in the preview that the presentation had gone wrong?
    Didn't you expect to see:

    static void delay( unsigned long cnt )
    {
       while( cnt-- );
    }
    

    Note that 'static' is a standard 'C' keyword that has nothing specifically to do Keil, nor ARM, nor with "this kind of function".

    You can look up the meaning of the 'static' keyword in any good 'C' textbook...

    See also: http://c-faq.com/index.html

Children