__func__ identifier in C

C++Server Side ProgrammingProgramming

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
raja
Published on 30-Apr-2019 12:49:19
Advertisements