Thread: ok this my be an easyone but

  1. #1
    Registered User
    Join Date
    Dec 2005
    Posts
    18

    Unhappy ok this my be an easyone but

    what is the line needed to set variables back to 0 or default after each run of a loop.. and ways do i have to store that data

    I was thinking with a write to file and than at the end of the loop have the hole file printf

    I am planing this little app right now so no code/just notations sorry

  2. #2
    Registered User
    Join Date
    Aug 2005
    Posts
    1,267
    just set each variable to some value when the loop starts
    Code:
    int num;
    int i;
    for(i = 0; i < 5; i++)
    {
       num = 0;
       // blabla
    }
    Use rewind(FILE*) to reset a file pointer back to the beginning of the file.

  3. #3
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Code:
    int num, i;
    
    for( num = i = 0; i < 5; i++, num = 0 )
    {
    
    }
    Remember, you can use all portions of the loop to set/test/whatever more than one value or function.


    Quzah.
    Hope is the first step on the road to disappointment.

Popular pages Recent additions subscribe to a feed
Website Security Test