Lesson/Example please

Richard Laager rlaager at wiktel.com
Mon Mar 15 19:06:02 UTC 2021


On 3/14/21 11:25 PM, Hal Murray via devel wrote:
> Can anybody give me a pointer to code that does this?  Or steer me in the
> right direction, or ...
> 
> There is a recursive tangle of struct needs function and function needs struct, but the function only needs a pointer to the struct so I think that should work.

Personally, I'd probably typedef the struct:

typedef struct _NtpSomething NtpSomething;
struct _NtpSomething
{
     void (*some_func) (NtpSomething *);
}


If you want to typedef the function too, something like this should work:

typedef struct _NtpSomething NtpSomething;

typedef void (*NtpSomeFunc)(NtpSomething *);

struct _NtpSomething
{
     void (*NtpSomeFunc) (NtpSomething *);
}

-- 
Richard


More information about the devel mailing list