- This topic has 2 replies, 2 voices, and was last updated 16 years, 11 months ago by .
Viewing 2 reply threads
Viewing 2 reply threads
- The forum ‘C Programming’ is closed to new topics and replies.
Home › Forums › C Programming › Pointer to a Vargs function
Hi Folks!!!!!
How can i define a pointer to a function with variable number of args..
However void pointer can hold the address of these functions , is there any other way of doing it …..
Ex: Declaration of a pointer to printf or scanf………..
Comments will be appreciated……
What’s the problem!!!!!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | int MyPrint( . . . ) { cout<<" Inside MyPrint"<<endl; } int (*ptr2MyPrint ) ( . . . ); int main() { ptr2MyPrint = Myprint; (ptr2Myprint) ( 2, 3, "Hi"); (ptr2Myprint) ( "ImFine", 13, 3.65,"Hello"); (ptr2Myprint) ( 2.78); return 0; } |
It’s working!!!!!
Why you are saying for void pointer. No logic to say here ” void pointer”. Only return type will be generic in case of void pointer.