gpt4 book ai didi

c - 函数返回它自己

转载 作者:行者123 更新时间:2023-12-02 08:09:08 25 4
gpt4 key购买 nike

<分区>

typedef logs_t(*logs_t)(char *);

logs_t logs(char *s) {
printf("%s", s);
fflush(0);
return &logs;
}

错误:

log.c:1:17: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
typedef logs_t(*logs_t)(char *);
^
log.c:1:9: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
typedef logs_t(*logs_t)(char *);
~~~~~~~ ^
log.c:1:15: fatal error: function cannot return function type 'int (char *)'
typedef logs_t(*logs_t)(char *);
^
2 warnings and 1 error generated.

我在这里想要实现的是将调用链接到logs:

logs("a")("b");

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com