Yeah it does indeed look like undefined behavior. I'm not saying I want to design programms like this - instead I'm trying to see what happens under the hood for better understanding.
@standley - I was trying to say "I read" - no stress my typo
Second last question then. Can anyone confirm the accuracy of these statements?
When static is appended to a function declaration it means - don't enter the function name as an external symbol in the generated object code for the current translation unit.
When static is appended to a function definition it means - this symbol in the generated object code is not made available outside of this object code.
Last question: I ADDED a function declaration in the foo.c file
Code:
staticintfoo(int);
int main ()
{
int result = foo(2);
printf("%i", result);
return 0;
}
Code:
extern int foo(int a);
extern int foo(int a) { return a * 2;
}
That is redundant correct? theres no reason to add it in because the declaration is already in main.c?