[ back to toc ]

static function

Date: 2002/02/20 10:11

Q:
hi

I know about scope rule using static for varialbes but am confused in
function.

for example, some function is
static int name(int ..){...} or
static void name(int ..){...} ,then

how does scope work? As I know, that function is only called from the
functions in the same file. is that true?
A:
The keyword static is used for two different thing in C and this is really
confusing. So do not feel ashamed you are confused, it is not your fault.

When a function is static the compiler generates an object code (.o or
.obj file depending on the operating system being some flavour of UNIX or
Windows NT) that does NOT contain the name of this function in the object
file symbol table. This symbol table is used by the linker to link object
files together into executable.

You can use static functions that you want to be prive inside the source
file. So it is true.

Regards,
Peter

*******************
Please take your time and rate me at AllExperts.com
I ask you to do that the way you believe I deserve.
This is a feedback that I get from allexperts but
it does not affect my life in any financial way. This
is just a mental feedback.

In case you think my answer was really good and if you feel
it appropriate do not hesitate to nominate me to volunteer
of the month.

I do this job volunteer in my free time and this is all I get
as compensation.

[ back to toc ]