Link to home
Start Free TrialLog in
Avatar of MaheshKP
MaheshKP

asked on

Static funtions

Hi
  Please explain me abt Static functions in C...
  Static variables which hold the values
with in the program,,But what is use with Static functions..

Is there static functions are available in C.. Ans is Yes then give me syntax and use of that functions with examples...


Thanks in advance
Mahesh
Avatar of KangaRoo
KangaRoo

static functions can only be used in the .c module in which they are defined, they are not visible in other modules.
Avatar of MaheshKP

ASKER

Hi Rao
   What ur telling is Static functions are available in C , Just like static
variables..My understand is correct means give me a ex..
ASKER CERTIFIED SOLUTION
Avatar of rbr
rbr

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Actually, I'm not even sure they are avavilable in ANSI C (I do mostly C++) but  GCC thinks it is.
MaheshKP!

In C language static functions are used for code hiding: static functions defined in the module are visible in that module *only*, i.e. linker can't see they though any other "ordinary" function is visible for linker.

So static functions are useful in multimodule projects.

Andrew
Example? just at the static keyword:

static void f()
{
   /*Ur code */
}


That's what I said, can only be used from the same module, isn't it?
KangaRoo, you are right.

Andrew
ThanQ for all

Mahesh