Can anyone explain me what extern is used for? I thought it was used to
declare variables definited in other files, but i can do that also
without extern.
/*file a.c*/
int a=5;
int main()
{
f();
}
/*file b.c*/
int a;
void f()
{
printf("%d\n",a ); /*it prints 5*/
}
Another thing, what happens if i declare a function like this: extern
int fn(void) ?
--
Devaraja (Xdevaraja87^gm ail^c0mX)
Linux Registerd User #338167
declare variables definited in other files, but i can do that also
without extern.
/*file a.c*/
int a=5;
int main()
{
f();
}
/*file b.c*/
int a;
void f()
{
printf("%d\n",a ); /*it prints 5*/
}
Another thing, what happens if i declare a function like this: extern
int fn(void) ?
--
Devaraja (Xdevaraja87^gm ail^c0mX)
Linux Registerd User #338167
Comment