Mail Archives: djgpp/1997/04/24/09:49:12
On 24 Apr 1997, Ian Mausolus wrote:
>
> What is the significance of the word "static" in front of a function name
> in C?
>
> for example:
>
> static void foo(int i)
> {
> ....
> }
>
> thanx,
>
> I. Mausolus
>
Static : function local in current file
file1 file2
------ -------
| static void foo() static int foo() |
| { /*...*/} { /*...*/ } |
| void F(){ foo();} int G(){ foo();} |
-----------------------------------------------
file1.o H file2.o
H
link H
V
OK! EXE
file1 file2
------ -------
| void foo() int foo() |
| { /*...*/} { /*...*/ } |
| void F(){ foo();} int G(){ foo();} |
-----------------------------------------------
file1.o H file2.o
H
link H Linking Error!
V
EXE
BAD...!!!
Good luck!!
Miguel
- Raw text -