How do people initialize large amounts of information in practice? Do they just read in files and convert them over dynamically?<div><br></div><div>(Sorry for the potentially stupid questions. I'm just coming to Pascal.)</div>
<div><br></div><div>Clay<br><br><div class="gmail_quote">On Tue, Jul 19, 2011 at 1:54 PM, Rainer Stratmann <span dir="ltr"><<a href="mailto:RainerStratmann@t-online.de">RainerStratmann@t-online.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Am Tuesday 19 July 2011 19:44:17 schrieb Clay Stuart:<br>
<div><div></div><div class="h5">> Hello Everyone:<br>
><br>
> I've got an array of records that looks something like this:<br>
><br>
> type<br>
> node = record<br>
> foo : array[1..10] of integer;<br>
> bar : array[1..10] of integer;<br>
> end<br>
><br>
> var<br>
> graph : array[1..5] of node;<br>
><br>
> begin...<br>
><br>
><br>
> However, the arrays hold different amounts of numbers. So node[1].foo<br>
> might hold 5 numbers while node[2].foo might hold only 2.<br>
><br>
> My Question...<br>
> Is there a way to initialize these numbers somehow. It seems the compiler<br>
> won't allow me to partly fill the arrays. If I use them, it appears I have<br>
> to use them all the way.<br>
><br>
> Thank you in advance,<br>
> Clay<br>
<br>
</div></div>I would do it like this.<br>
<br>
const cntmax = 5;<br>
var cnt : longint;<br>
<br>
procedure init_counter;<br>
begin<br>
cnt := 0;<br>
end;<br>
<br>
procedure init( v1 , v2 , v3 , v4 , v5 , v6 , v7 , v8 , v9 , v10 : integer );<br>
begin<br>
if cnt < cntmax then begin<br>
with graph[ cnt ] do begin<br>
foo[ 1 ] := v1;<br>
foo[ 2 ] := v2;<br>
...<br>
foo[ 10 ] := v10;<br>
end;<br>
inc( cnt );<br>
end;<br>
end;<br>
<br>
init_counter;<br>
init_arr( 34 , 56 , 33 , 44, 44, 56, .. , .. , .., 77 );<br>
init_arr( 34 , 56 , 33 , 44, 44, 56, .. , .. , .., 77 );<br>
init_arr( 34 , 56 , 33 , 44, 44, 56, .. , .. , .., 77 );<br>
init_arr( 34 , 56 , 33 , 0,0,0,0,0,0,0 );<br>
<div><div></div><div class="h5">_______________________________________________<br>
fpc-pascal maillist - <a href="mailto:fpc-pascal@lists.freepascal.org">fpc-pascal@lists.freepascal.org</a><br>
<a href="http://lists.freepascal.org/mailman/listinfo/fpc-pascal" target="_blank">http://lists.freepascal.org/mailman/listinfo/fpc-pascal</a><br>
</div></div></blockquote></div><br></div>