Thread: Pokemon - repost

  1. #16
    Registered User
    Join Date
    Jun 2011
    Posts
    4,513
    Quote Originally Posted by sureme View Post
    What do you mean by initialise ?
    Set the variable to a known value before incrementing it.

    Code:
    /* Wrong */
    
    int experience;  // uninitialized, contains garbage value
    
    experience++;    // incrementing the garbage value - no good
    Code:
    /* Correct */
    
    int experience = 0;  // initialized to zero
    
    experience++;        // valid increment

  2. #17
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    > What do you mean by initialise ?
    It's something you should know already from the first few pages of your C book / tutorial / lecture notes.
    I suggest you review the material you already have.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C program - pokemon
    By sureme in forum C Programming
    Replies: 4
    Last Post: 01-03-2017, 09:29 AM
  2. Binary Search Help Repost.
    By Sid_TheBeginner in forum C++ Programming
    Replies: 10
    Last Post: 06-29-2012, 03:58 PM
  3. Pokemon MMORPG?
    By FiftyNine50 in forum Projects and Job Recruitment
    Replies: 4
    Last Post: 07-25-2007, 04:05 PM
  4. repost: still stuggling w/for loop
    By learnin2program in forum C++ Programming
    Replies: 8
    Last Post: 02-19-2002, 07:19 PM
  5. Replies: 2
    Last Post: 09-10-2001, 12:00 PM

Tags for this Thread