C/c programming
Expert: Zlatko - 9/13/2009
Questionhello sir.i have a problem
main()
{
printf("%u",main);
}
when i m compiling it,its giving an error- Cannot take address of 'main' in function main()
but from the book i took the question,says that it should return the starting address of main,as the name of the function is the pointer to it.can you plz explain what's correct and the logic behind it..thanks
AnswerHello Prachi
You are correct. The program should print out the address of the main function. I have tried it with the Microsoft compiler and the Gnu compiler and it works as expected. I would say the compiler you are using is not up to the standard. This is not unusual for older compilers. Which compiler are you using?
Best regards.
Zlatko