--- In [email protected], "Booji" <spudg...@...> wrote:
>
> Hi everybody ...
> 
> I defined and initialized an array of pointers to functions like this :
> 
> int (*Func [])() = {..,..,..} .
> 
> How do I get the size of the whole array ?

#include <stdio.h>

static int i;

static int fn1(void)
{
    return i++;
}

static int fn2(void)
{
    return i--;
}

int main(int argc, char *argv[])
{
    int (*Func[])(void) = {fn1, fn2};

    printf("size (bytes): %d\nnumber of items: %d\n",
        sizeof Func, sizeof Func / sizeof *Func);

    return 0;
}


Reply via email to