quick question about int main()

This is a discussion on quick question about int main() within the C Programming forums, part of the General Programming Boards category; hello guys,
i have very quick question, i dont no might be very silly. is that true that if main ...

quick question about int main()

hello guys,
i have very quick question, i dont no might be very silly. is that true that if main fucntion too long it is a worst programming pratice. i havn't heard about this or read an any book. is that true if the main is too long is it worst programming practice. can any one direct me in right direction. for the proof

If something is "too <adjective>" then it's bad by definition. How you judge it is quite subjective and depends on many things. I'd say that in general no function should be made very long, and main is no exception. If it makes sense to break it up into smaller functions, then do so.

thanks CWR for your reply, the reason why i asked this was my teacher argues with me saying that u'r is worst programme for just being my main a bit longer. she dont even bother about the other fucntion being longer. she just says that u'r main is long. no credits for that. even though program compiles fine with error or warnings and gives the output which was expected and moe user freindly.

> is that true that if main fucntion too long it is a worst programming pratice.
Only in the sense that it's bad for any function to be too long.

Fair enough, a function which is just a big switch/case of many possible choices, where each choice results in a function call could be hundreds of lines long, but it would be totally obvious what was going on.

But a single function playGameOfTicTacToeReadingUserInputAndChoosingComp uterMoves() would just be awfully bloated.

If you think splitting a function would improve the clarity of the program, then you should probably do it.