Tech Support > Computers & Technology > Programming > can I see the function name ?
can I see the function name ?
Posted by xmatrix on August 25th, 2003


I want to know about the function name that is pointed function like
below.
sometimes, I could use the __FUNCTION__ but, that macro could be used
in the printf () or printk ().
In my case,for example, there are so many function like commando(),
rambo(), xman() and spiderman(). but, I don't know exact name of
hunter function is pointed by the other function
how do I know that the real function name of pointed by hunter().

I can only change main function.....
not rambo, or commando function.


do you understand my content???
I cannot english very well.
plz comment this problem...
Is this possible or impossible

#include<stdio.h>
void (*hunter)(void);
void commando(void){
printf("I am commando\n");
}
void rambo(void){
printf("I am rambo\n");
}

int main(void)
{
hunter=rambo;
hunter();
return 0;
}

Posted by Josh Sebastian on August 25th, 2003


On Mon, 25 Aug 2003 00:49:40 -0700, xmatrix wrote:

If I understand you correctly, you want to check to see which function
hunter points to.

if(hunter == rambo)
puts("hunter points to rambo");
else if(hunter == commando)
puts("hunter points to commando");
/* etc */

Josh


Similar Posts