Function 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: 2019-07-30T22:30:25+05:30

277 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements