Hello All,
I would like to declare an array of function pointers and initilaize them. These functions neither accept nor return anything.
Please advise,
B Al
This is a discussion on Array of pointer function within the C Programming forums, part of the General Programming Boards category; Hello All, I would like to declare an array of function pointers and initilaize them. These functions neither accept nor ...
Hello All,
I would like to declare an array of function pointers and initilaize them. These functions neither accept nor return anything.
Please advise,
B Al
Last edited by BigAl; 11-13-2001 at 06:18 PM.
I've never had occasion to use function pointers, but this might be correct:
void (*fptr[SIZE])(void);
Quzah.
Hope is the first step on the road to disappointment.
But how do I make functions with __cdecl calling convention?
Thanks,
B Al
Google.com is your friend. Actually, I've never used this either. However, according to the MSND entry , you do something like:
Quoted from the above MSDN link. Run your keyword '__cdelc' through google and see what else you can come up with.Example:
In the following example, the compiler is instructed to use C naming and calling conventions for the system function:
Code:// Example of the __cdecl keyword _CRTIMP int __cdecl system(const char *);
Quzah.
Hope is the first step on the road to disappointment.
Pointers to functions get out of hand too quickly, so I always use a typedef.
Code:typedef void /*__cdecl*/ (*fn_ptr_type)( void ); void fn_one ( void ) { } void fn_two ( void ) { } fn_ptr_type arr[] = { fn_one, fn_two, };
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
I support http://www.ukip.org/ as the first necessary step to a free Europe.