hi,
i'm puzzled by the use of the extern keyword.
1) when used in functions, it's just for stylistic purposes.
So, that use is pretty clear.
2) when used in variable declarations what's the purpose?
e.g.
test1.c
Code:#include <stdio.h>
int a; /* extern????? */
/* extern int a; */
void f1();
int main() {
a = -3;
f1();
printf( "a=%d\n", a );
return 0;
}
test2.c
i can't see the difference.Code:#include <stdio.h>
int a;
void f1()
{
printf( "a=%d\n", a );
a=4567;
}
shouldn't the compiler give a warning/error when the keyword extern isn't used?
or at least the two variables shouldn't affect each other.
thanx in advance,
trk