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