wrote:
> Hi all,
>
> I have heard many discussions among my colleagues that main is a user
> defined function or not.
>
> arguments in favour:-
>
> 1) if it is built in function it must be defined in some header file
> but it is n't.
That argument doesn't hold up. Depending upon the implementation, there
might be quite a few functions that are not declared in standard
headers, but which are also not user defined. These might be hidden
helper functions that are called by routines from the C standard
library. These might be routines which are executed to emulate in
software C features for which native hardware support is lacking on a
particular platform, such as long-double _Complex arithmetic on a
platform which has native support only for 8-bit integer arithmetic.
> 2) every time we are defining how the main function should work
That is precisely the definition of "user defined", and the only
relevant argument you've cited.
> arguments against:-
>
> 1)user defined functions cannot be called from command line
That's also true for main(). What you call from the command line is the
entire program, which eventually results in a call to main(); and later
on, it eventually may result in a call to any of the other user-defined
functions in the program.