How to store function-name and its return values while program runs