passing data structures to function pointers and get there values

hi all,
please see this example and say what should i do
1
2
3
4
5
6
7
8
9
10
typedef struct example_dt_struct {
int a;
float b;
char* c;
};
typedef void(*func)(example_dt_struct *s, int e, int f);
void f(func *n)
{

}

how can i use example_dt_structure with my function pointer into f()
thanks in advance
Last edited on
1
2
3
4
5
void f(func *n)
{
    example_dt_struct foo;
    n(&foo, 0, 0);
}
ok, how can i access foo.a or foo.b or foo.c?
through the passed pointer
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
void some_function(example_dt_struct *s, int e, int f)
{
    s -> a = e;
}

void f(func *n)
{
    example_dt_struct foo;
    n(&foo, 0, 0);
}

int main()
{
    f(some_function);
}
ok, how can i access a variable in a function type?
for example, from a function, get access to a parameter of a typedef?
In my example func is a typedef.
Topic archived. No new replies allowed.