How to get the call function name in C

2 Answers

0 votes
#include <stdio.h>

void test()
{
    printf("call to function: %s\n", __func__);
}

int main(void)
{
    test();
    
    return 0;
}

   
/*
run:
 
call to function: test

*/

 



answered Aug 30, 2017 by avibootz
0 votes
#include <stdio.h>

int main() 
{ 
	printf ("%s\n", __func__);
     
    return 0; 
} 
   
  
      
/*
run:
       
main
  
*/

 



answered Jul 3, 2020 by avibootz

Related questions

1 answer 210 views
1 answer 103 views
1 answer 158 views
158 views asked Apr 5, 2024 by avibootz
1 answer 150 views
1 answer 122 views
1 answer 162 views
1 answer 121 views
...