Code:
int myinteger;
int myfunction();
int main(int argc, char *argv[])
{
myinteger=33;
myfunction();
printf("myinteger is now %d\n",myinteger);
return 0;
}
Code:
#include <stdio.h>
extern int myinteger;
int myfunction()
{
printf("Hallo;\n myinteger is %d\n",myinteger);
myinteger=44;
return 0;
}
when I compile this code with
Code:
gcc -Wall test1.c test2.c -o myapp
it is happy
If I omit the extern and recompile, it's still happy? Question is why that would be
From my turboC days I seem to remember that 'extern' was required in situations like above. Does the compiler nowadays take care of this? Or is there something else that I'm missing?