savage@boulder.Colorado.EDU (Charles L Savage) (02/23/89)
I am having major problems getting a pointer to a fuction to execute. Somehow the calling fuction, when is should call the passed function it is just dropping out of its own function as if it had executed a return statement, instead of the fuction call. Can somebody point me in the right direction? Here is the code as close and as short as I could make it: void copy_func(); /* data dependant copy function */ main() { ... (void) g(copy_func); ... } char * g(cpy_ptr) void (*cpy_ptr)(); { ... (void)printf("before call\n"); (*cpy_ptr)(data1, data2); /* data1 and data2 are pointers to structures of type DATUM */ ... } void cpy_func(t,f) DATUM *t, *f; /* copy (struct)DATUM 'f' to (struct)DATUM 't' */ { (void)printf("Here I am in cpy_func\n"); *t = *f; ... } The program executes g() through "before call", then drops out just after printing "before call" just as if it had hit a return statement. ^ // // _ # /@\ #------------------------------------------------------. {@@@}%%%%%%%%%%%%#=======================================================> \@/ #------------------------------------------------------' # \\ Savage%alta@boulder.colorado.EDU \\ v