Please explain why it uses extern
in function declaration?
main.c
...
pthread_create(&displayThread, &attr, displayThrFxn, &displayEnv);
...
display.h
extern Void *displayThrFxn(Void *arg);
Why extern
?
display.c
...
Void *displayThrFxn(Void *arg)
{
// some code
}
...
The use of extern
here is kind of redundant. By default, if nothing is specified, functions have external linkage.
Quoting C11
standard, chapter §6.2.3
If the declaration of an identifier for a function has no storage-class specifier, its linkage is determined exactly as if it were declared with the storage-class specifier
extern
. [...]