To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.roboticsOpen lugnet.robotics in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / 27110
27109  |  27111
Subject: 
Re: circular pointer
Newsgroups: 
lugnet.robotics
Date: 
Sat, 12 May 2007 22:59:03 GMT
Viewed: 
4732 times
  
In lugnet.robotics, linmix <linmix@gmail.com> wrote:
i = (i+1) % SIZE;

It looks like only the last value is recycled, when what should happen
is that the first value is eliminated and the second becomes first, the
third second and the new one the last.

The line above is the line that cycles the array - each time through the loop it
increments i and resets it to zero if it's >= SIZE (% is modulus operator).

But I would agree with you about the v[i]=0 line - seems to me it would make the
running sum incorrect. Removing it should make the program work as expected.

ROSCO



Message is in Reply To:
  circular pointer
 
Some time ago some of you offered to help out if I (and I suppose anyone else) had any questions about programming.... well, here goes I'm reading "Building Robots with Lego Mindstorms" and in Chapter 12, there is some code to create a circular (...) (18 years ago, 12-May-07, to lugnet.robotics)

8 Messages in This Thread:



Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR