suppose i have 3 functions:
a()
b()
and c()
both a() and b() can called c(). if function c() is called how do i know who is the caller??
shanki himanshu 27 Light Poster
Recommended Answers
Jump to PostYou can pass the name of the caller into the callee:
void a(const char *caller) { printf("%s called from %s\n", __func__, caller); } void b(const char *caller) { printf("%s called from %s\n", __func__, caller); a(__func__); } int main(void) { b(__func__); return 0; }
The above code uses …
All 4 Replies
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
shanki himanshu 27 Light Poster
Narue 5,707 Bad Cop Team Colleague
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.