功能参数

发布于 2024-11-02 11:15:56 字数 246 浏览 2 评论 0原文

我必须在这个函数中放置什么作为第二个参数?我需要理解 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);

谢谢!

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

墟烟 2024-11-09 11:15:56
 int (*fn)(const char *, const struct stat *ptr, int flag)

是一个指向函数的指针,该函数返回一个 int 并接受一个 const char*、一个 const struct stat * 和一个 int

如果您有此函数:

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

您可以将 func 作为该参数传递。

 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文