[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] pointer to functions
From: |
Joerg Wunsch |
Subject: |
Re: [avr-gcc-list] pointer to functions |
Date: |
Tue, 15 Apr 2003 11:51:35 +0200 (MET DST) |
"Rune Christensen" <address@hidden> wrote:
> I need to make a struct with two pointers called init and done.
>
> typedef struct
> {
> init
> done
> } sblock;
>
> In the main there should be something like this
> sblock sb;
>
> sb.init = &(loginit());
> sb.done = &(logdone());
>
> It should be possible to write
> init()
> done()
>
> But can that be done in a AT90s8515 ??
This is a generic C question, completely unrelated to the AVR.
void loginit(void)
{
...
}
void logdone(void)
{
...
}
struct
{
void (*init)(void);
void (*done)(void);
} sb = {
loginit, logdone
};
...
sb.init();
sb.done();
--
J"org Wunsch Unix support engineer
address@hidden http://www.interface-systems.de/~j/