1

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!!

0

1 Answer 1

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

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

1 Comment

I would say it is not a function, rather, a function pointer.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.