I want to call functions defined in test.c from other.c.
Can I extern
the function1
to call it? Also, do I have to use extern
in function2
and function3
, which are being called by function1
?
other.c
extern function1();
function1();
test.c
void function1()
{
function2();
function3();
}
void function2()
{
}
void function3()
{
}
extern
simply tells us that it is defined somewhere else. And you are using it in the file you are writing theextern
. But functions are by default extern. So you need not be explicit about it.