Advertisement

Pointer Stuff

Started by December 10, 2002 10:11 AM
1 comment, last by Der Fellfrosch 21 years, 11 months ago
I have a pointer to an array of function pointers in a structure. How might I go about passing a copy of the structure that contains these functions to the functions, when they are called, especcially if the structure is in a linked list? i.e.: typedef struct X { void (**funcs)( *problem Here* ); struct X *next; } X; When I will traverse the list of structures and call all of their procs in the funcs array, what do I need to do?
struct X;typedef void X_func_t( struct X );struct X{  X_func_t** funcs;  // or  void (**funcs)( struct X );  struct X* next;}; 


Note - unless you''re using C, don''t use typedef with your structs, and if you do, typedef to a different name !!!

[ Start Here ! | How To Ask Smart Questions | Recommended C++ Books | Free C++ IDE. ]
[ Header Files | File Format Docs | LNK2001 | C++ STL Doc | STLPort | Boost C++ Lib ]
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
Advertisement
Thanks. And I am just using C.

This topic is closed to new replies.

Advertisement