menu search
brightness_auto
more_vert

What is a main() and difference b/w void main() and int main()?

thumb_up_off_alt 1 like thumb_down_off_alt 0 dislike

1 Answer

more_vert
 
verified
Best answer
main() is an entry point ( main function) which is in most programming languages, When compiler begins compile the program, It looks for an entry point, and main() acts as an entry point in C program, or we can say main is a thread/ process/ function that invokes automatically by the compiler when program is being executed.

Every function returns a value to the calling function, at that time main will be a called function for compiler/OS and it will return some value to the compiler before exit, here void and int defines that main will return a void ( nothing) and int will return an integer values to the compiler.
thumb_up_off_alt 0 like thumb_down_off_alt 0 dislike

Related questions

thumb_up_off_alt 1 like thumb_down_off_alt 0 dislike
1 answer
thumb_up_off_alt 0 like thumb_down_off_alt 0 dislike
1 answer
thumb_up_off_alt 1 like thumb_down_off_alt 0 dislike
1 answer
thumb_up_off_alt 0 like thumb_down_off_alt 0 dislike
1 answer
thumb_up_off_alt 0 like thumb_down_off_alt 0 dislike
1 answer
thumb_up_off_alt 0 like thumb_down_off_alt 0 dislike
1 answer

Doubtly is an online community for engineering students, offering:

  • Free viva questions PDFs
  • Previous year question papers (PYQs)
  • Academic doubt solutions
  • Expert-guided solutions

Get the pro version for free by logging in!

5.7k questions

5.1k answers

108 comments

648 users

...