Path: utzoo!attcan!uunet!tut.cis.ohio-state.edu!snorkelwacker!bu.edu!rpi!pawl12.pawl.rpi.edu!joefritz From: joefritz@pawl12.pawl.rpi.edu (Jochen M. Fritz) Newsgroups: comp.lang.c Subject: varargs -> normal parameters Message-ID: Date: 17 Jul 90 19:42:54 GMT Organization: Rensselaer Polytechnic Institute, Troy NY Lines: 41 I want to write a function, that can call any other function. The called function and its parmeters are given as parameters so that it can be called. The clintcher is since I want to be able to call anything how can I dereference the parameters to call the function? for example: void foo (void (*fn)(), ...) { (*fn) (...) <- how can I do this line? } void bar (int num, char ch) { printf ("%d %c",num, ch); } main () { foo (bar,12,'b'); } If there is a portable (ANSI) way to do this, that would be great, but if I have to resort to a machine dependant solution (ie pushing the stuff onto the stack with inline assembly), I`d survive. My compiler is Turbo C++, but for now I'm sticking to just C, (I don't wamnt C++ code). I do have a 8086 assembler. Any help would be appreciated. Please no flames as to why I would want to do this. It would be the most elegant solution to my problem. Thanx ------------------------------------------------------------------------ | Jochen Fritz | For though we live in the world, we do not | | joefritz@pawl.rpi.edu | wage war as the world does.-- 2 Cor. 10:3 | | usergk2s@rpitsmts.bitnet| You have heard it said, Love your neighbor | | Noah [the peace monger] | and hate your enemy. But I tell you: Love | | | your enemies. Matt. 5:43-44 | ------------------------------------------------------------------------