[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

Re: pointers to functions



deepak yadav encoded : 
>hi
>this mail is with refrence to my previous mail which goes like this
>
>>i have few functions say a(), b() ,c() ...
>>i want to call these functions, each within same statement seperated by comma.
>>e.g 
>> ( a() , b() , c() );
>>the problem is -- i want to vary the number and ordering of these functions within that statement at run time.

Use an array of function pointers, but define the function with a signature as

void foo(int n, ...);

and use ellipses to convert back. And yes, this is an ugly hack, and as pointed out before, ideally you should use C++ with a vector<funcptr * > passed in.

Cheerio,
M  

   Madhu M Kurup /* Nemo Me Impune Lacessit */ madhu@xxxxxxxxxxx