0
main()
{---
----
----
}





main(int a, char **b)
{---
---
---
}

main can be used in the both the ways in c but if there is no concept of function overloading in c how can the above be achieved.

Edited by penty.kn: simply

4
Contributors
3
Replies
29
Views
4 Years
Discussion Span
Last Post by Nutster
0

The compiler can do whatever it wants. Given that at least two overloads of main() are required by the language definition, the compiler simply has to conform to that even though it doesn't need to support a general function overloading mechanism.

0

Also it's not really overloading, if you put both into a single program you would get an error, it has to be one or the other. True overloading, like C++ would allow both function definitions to co-exist, if this where not main. C++ also does not allow overloading of main like this in the same program almost certainly because it only makes sense to have a single entry point.

0

Really all that is happening is that in the first form, the program is ignoring the passed parameter array. It is not true overloading as you see in Java or C++.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.