本文介绍了用C循环定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经写的是:

typedef enum _MyStatus
{
    MY_STATUS_OK = 0,
    MY_STATUS_GENERAL_ERROR = -1,

} MyStatus;

typedef MyStatus (*MyCallback)(MySettings *settings);

typedef struct _MySettings
{
    MyCallback callback;
} MySettings

不过,它不会编译定义myCallBack函数,它不知道MySettings的时。如果我换MySettings和myCallBack函数,这将是倒过来:MySettings不知道myCallBack函数的

However, it wouldn't compile as when defining MyCallback it doesn't know of MySettings. If I swapped MySettings and MyCallback, it would be the other way round: MySettings wouldn't know of MyCallback.

如何一般这类问题用C处理的?

How generally is this sort of problem handled in C?

谢谢!

推荐答案

怎么样把这个线在顶部:

How about putting this line at the top:

typedef struct _MySettings MySettings;

这可能?可以使用。

这篇关于用C循环定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-27 16:57