Importance of...

This is a discussion on Importance of... within the C++ Programming forums, part of the General Programming Boards category; Two simple things... 1. Is it important to include return 0; in int main()? As i understand this tells the ...

  1. #1
    Registered User
    Join Date
    Mar 2005
    Posts
    27

    Importance of...

    Two simple things...

    1. Is it important to include

    return 0;

    in int main()?

    As i understand this tells the program that it has executed successfully however it doesn't seem necessary (in as much as it works without it). Should i be including it or is it okay to omit it? (from the perspective of good programming practices).

    2. Do you still have to seed the random number generator? (ie. srand before rand). In php it is no longer necessary as it's done automatically but i get the impression that with C++ it is still required.

    I really appreciate the help i have received from members of this forum to date, thank you.

  2. #2
    Rabite SirCrono6's Avatar
    Join Date
    Nov 2003
    Location
    California, US
    Posts
    269
    No, return 0 is not required. However, it's good programming practice to include it.

    Yes, you still need to seed the random number generator. I hope this helps you out!

    - SirCrono6
    From C to shining C++!

    Great graphics, sounds, algorithms, AI, pathfinding, visual effects, cutscenes, etc., etc. do NOT make a good game.
    - Bubba

    IDE and Compiler - Code::Blocks with MinGW
    Operating System - Windows XP Professional x64 Edition

  3. #3
    Registered User
    Join Date
    Apr 2003
    Posts
    2,662
    I cast my vote with SirCrono6 on both issures.

  4. #4
    Registered User
    Join Date
    Mar 2005
    Posts
    27
    Thanks =)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. importance of returning reference in operator overloading.
    By vaibhavs17 in forum C++ Programming
    Replies: 20
    Last Post: 05-13-2009, 12:28 PM
  2. importance of port number
    By gooddevil in forum Networking/Device Communication
    Replies: 4
    Last Post: 06-06-2004, 02:24 PM
  3. Importance of knowing linux when trying to get a c programming position
    By Terrance in forum A Brief History of Cprogramming.com
    Replies: 42
    Last Post: 09-28-2002, 04:26 AM
  4. School and the importance of a degree
    By m00se123 in forum C++ Programming
    Replies: 2
    Last Post: 02-13-2002, 01:16 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21