7t*******@gmail.com wrote:
: Hi people...
: Here's my question...
: a function other than main is getting executed
: you have to find out which function called this function
: how can we do in C...?
You could rewrite your functions to include that information
(No pretense of being real code)
main()
{
do_something("from main",1,2,3);
}
do_something( char *from, int i, int j, int k)
{
do_something_else("do_something",'a','b','c');
}
do_something_else( char *from, etc...)
{
printf("I was called from %s",from);
}
To get a full stack trace you would have to add some kind of link as well,
but I haven't thought to add that here.
Various compilers and debuggers have options to help do this sort of thing
much easier.
--
This programmer available for rent.