c - Passing struct as a parameter in place of void* -


i have function accepts void* parameter, want use if it's struct.

typedef struct struct1 {     int val; } struct2;  void func1(void* struct3) {     printf("%d",struct3->val); } 

my purpose example, if have .h file function defined as

typedef void* parameter1; void func1(parameter1 p1); 

and wants use struct parameter in function, without declaring struct in .h file.

thanks answer printf("%d",((struct2 *)struct3)->val) mentioned @i486, that's looking for.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -