<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
<html><body>
<p> </p>
<div>I have some issues when assigning a pointer to a pointer variable. Consider this:</div>
<div> </div>
<div>
<p> TVertex = record<br /> x: double;<br /> y: double;<br /> end;<br /> PVertex = ^TVertex;</p>
<p> TEdge = record<br /> v1: PVertex;<br /> v2: PVertex;<br /> end; </p>
<p> </p>
<p>I have assigned a value to a vertex variable. In my code I have an array of TEdge. When I try to assign a vertex to the edge element in the array the x value suddenly is changed to 3e-308 (or something similar). I don't understand why, perhaps someone could help me to figure this out.The code I'm using to assign the value is shown below. To my knowledge assigning a pointer this way is perfectly legal not?</p>
<p> </p>
<p>procedure add_edge(v1, v2: PVertex);<br />begin<br /> inc(edge_count);<br /> SetLength(edge_list, edge_count);</p>
<p> edge_list[edge_count - 1].v1 := v1; //<---- after this line the value of v1^.x suddenly is changed!!??!!<br /> edge_list[edge_count - 1].v2 := v2;<br />end;</p>
<p> </p>
<p>TIA, Darius</p>
</div>
</body></html>