I have forgotten
my Password

Or login with:

  • Facebookhttp://facebook.com/
  • Googlehttps://www.google.com/accounts/o8/id
  • Yahoohttps://me.yahoo.com
Index » Programming » C/C++ »

Need Help?

CodeCogs\′s Photo
16 May 10, 7:56PM
Need Help?
In answer to your points:

  • void main() and int main(void) are for all practical purposes identical. On Unix/Linux machine, all programs need to return something, so most code is written using int main(). As for the void, well that should never be necessary, but some compilers require it.
  • In the following code a and b are parameters
int fred(int a, int b) { .. }
  • There is no different between ++i and i++ in a for loop. i.e. the following loops are identical:
for(int i=0; i<10; i++) { ... } 
for(int i=0; i<10; ++i) { ... }
In case someone argues that ++i is faster than i++, well thats wrong. All compilers are smart enough to optimise for this. If your really interested in speed, then you should always count downwards, as in
for(int i=9; i>=0; i--) { ... }
Currently you need to be logged in to leave a message.