0

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)

3
  • Discover cdecl.org Commented Aug 29, 2019 at 17:57
  • @IgorS.K.: cdecl.org reports a syntax error for the declaration in the question. It apparently fails with named parameters. Commented Aug 29, 2019 at 17:59
  • @EricPostpischil You're right, looks like it does fail. But it is still a worthy tool to know about. Commented Aug 29, 2019 at 18:26

2 Answers 2

7

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 *.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you for your help!
1

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.