top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How main function is different then other functions in C?

+1 vote
465 views

This was asked today in my interview and I was not having any clue. Any pointer would be helpful.

posted Aug 24, 2015 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

main() is the entry point as far as C is concerned. The loader sets the main()'s address as the contents of the program counter once the loading is complete and the state of the program changes from "loading" to "running"

  • You cannot have 2 or more main()s in an application. Only main() is permitted in the application
  • main() should be in the global namespace
    -main() cannot be a member function
  • main() has a few predefined prototypes

You may want to check https://en.wikipedia.org/wiki/Entry_point#C_and_C.2B.2B

answer Aug 24, 2015 by Sudeep Gopal
Similar Questions
+1 vote

Does there exist any way to make the command line arguments available to other functions without passing them as arguments to the function in C programming?

+2 votes

If I correct , by default main () function has integer return type.
I want to know what happens in the system internally when its return type gets changed from integer to void ?

+1 vote

We have two types of main declaration i.e.

void main()
and
int main()

I want to know the difference between these two and when to use what?

...