Guess the best way to explain what I need is through the code itself.
The main function invokes the func routine. If the user wishes to log the event at which the func routine is called, he sets a global parameter at run-time. Depending on whether the parameter is set or not, the appropriate func routine must be invoked.Code:# include<stdio.h> int func(void); int pfunc(void); int pfunc() { int val; /* do some work */ return val; } int func() { int ret; /* log the start of event in a file with the time */ ret = pfunc(); /* log the end of event in a file with the time */ return ret; } int func() { int ret; ret = pfunc(); return ret; } int main() { int ret; ret = func(); printf(" return value = %d\n",ref); return 0; }
Could someone help me out and suggest a way of doing it?