dani
dani

Reputation: 341

Function parameters

What I have to put as second parameter in this function? I need to understand the meaning of int (*fn)(const char *, const struct stat *ptr, int flag).

int 
ftw(const char *path, int (*fn)(const char *, const struct stat *ptr, int flag), 
int depth);

Thank you!!

Upvotes: 1

Views: 128

Answers (1)

Lou Franco
Lou Franco

Reputation: 89232

 int (*fn)(const char *, const struct stat *ptr, int flag)

is a pointer to a function that returns an int and takes a const char*, a const struct stat *, and an int.

If you had this function:

 int func (const char *s, const struct stat *ptr, int flag)
 {
      return 0;
 }

You could pass func as that argument.

Upvotes: 6

Related Questions