is this a valid statement in in c: &main, where main is int main()? If so why?

Recommended Answers

homework problem??? If so, then study about function pointers (or pointers to functions). Once you understand that then you will have the answer to your question.

Jump to Post

All 3 Replies

homework problem??? If so, then study about function pointers (or pointers to functions). Once you understand that then you will have the answer to your question.

The main() function is not allowed to be called inside a program. As far as I know, this means no function pointer is allowed to point to it either. I'm sure your results may vary from compiler to compiler. The only sure way is to try it yourself.

The main() function is not allowed to be called inside a program.

You're thinking of C++. It's legal in C (though rarely a good idea).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.