__func__ identifier in C


Here we will see what is the __func__ C.

Basically the __func__ or __FUNCTION__ (Some old versions of C and C+ + supports __func__). This macro is used to get the name of the current function.

Example

#include<stdio.h>
void TestFunction(){
   printf("Output of __func__ is: %s\n", __func__ );
}
main() {
   printf("Output of __func__ is: %s\n", __func__ );
   TestFunction();
}

Output

Output of __func__ is: main
Output of __func__ is: TestFunction

Updated on: 30-Jul-2019

223 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements