Pointers to Data Memory

procedure Form.Average;

{Average the x values for Graph series 1.}

var i,N:Integer; xsum:Double; xPtr:VecPtr;

begin

sum:=0;

With Graph Do

begin

N:=numPointsFromSeries(1);

For i:=1 to N do sum:= sum+xPtr^[i];

sum:=sum/N;

end;{of with}

end;

{This is very fast BUT you do not have any protection against memory errors.}