: : : : 'main' is of return type int, not void. See e.g. www.codepedia.com/1/CppMain for references.
: : : : bilderbikkel
: : : :
: : : :
: : :
: : :
: : : I have the feeling he isn't listening to you...
: : :
: : : fflush(stdin) isn't C standard either.
: : :
http://c-faq.com/stdio/stdinflush.html
: : :
Yes... that's just what's provided from my course and I discussed with my tutor about it once regarding using the
void instead of
int, and using
fflush(stdin).
The reason why they keep using
void is to keep the coding simple. Well this is what they said and if using
void is not proper I think they should start using
int but what I think is when the course started, as everyone goes thru, it started from "Hello World" and because it used only
printf it used
void on
main.
As for
fflush(stdin) I also tested couple times and found it's unnecessarry unless you use
scanf or other functions that needs the input buffer flush. If I just want to
pause the screen,
getchar(); is enough. Dont recall what they exacly explain to me... but the reason why they use is to clear any unuse buffer before pausing the screen. But I think if the code is simple like mine then we clealy know if we need or not. Then, I think everyone has their style of programming. Somehow my tutor thought to keep using it..
If I were to programme from the scratch. I use
int for main function and use
fflush(stin) only when I need it. For every programme so far I coded (except the one to interact with the files) I pause the screen all the time and I use only
getchar();.