What does "extern" do?
ex. extern int x;
and another question, what about using static in functions? like: static void foo(), why?
What does "extern" do?
ex. extern int x;
and another question, what about using static in functions? like: static void foo(), why?
You really need to read a book on C programming, but I will try a brief answer.
If I do "extern int errno" I am telling the compiler that errno is an integer. But it is really defined in some other module. So the compiler will not create a variable called errno, it will just reference it. Then when I run "ld" I better be including a module that defines errno without the extern.
Putting "static" on a function will make the function invisible to the outside world. It can only be called by other functions in the same source file.
aha thanks allot!
I do have a C book but I did not have it with me here. I was confused whilst reading source file.