Aniruddha
Aniruddha

Reputation: 1039

extern struct declaration in C

I'm fairly new to C, hence could someone please help me understand the below struct declaration?

extern struct server_module* module_open (const char* module_path);

Per my understanding, module_open is pointer to the struct server_module, however, didn't understand the last part of the statement i.e. (const char* module_path)

Upvotes: 0

Views: 124

Answers (2)

ChauhanTs
ChauhanTs

Reputation: 469

module_open is a function which returns pointer to struct server_module

and const char* module_path is input argument type. Means function takes character string as an input extern keyword is used to tell compiler that symbol is exist in different file

Upvotes: 1

Eric Postpischil
Eric Postpischil

Reputation: 224092

extern struct server_module* module_open (const char* module_path); declares module_open to be a function taking a parameter named module_path of type const char * and returning a struct server-module *.

Upvotes: 7

Related Questions