Array of Record (Struct) in Pascal (1 Viewer)

AntiHyper

Revered Member
Joined
Sep 16, 2004
Messages
1,102
Location
Tichondrius
Gender
Male
HSC
2005
I need to know for my work project since we're meant to create an array of driver licenses and their properties.
currently i'm just guessing:

type licenseRec = record
licId:integer;
firstName:string[16];
<<stuff here too much to write up>>
end;
var drivers:array[1..32]of licenseRec;
...

And to copy a bit of info from array 'c' into a 'str':

str:=drivers[c].firstName;

In C i found out that you need a pointer. Maybe for Pascal aswell but i haven't taught of var ptr:pointer;
 

redruM

Breathe and Stop
Joined
May 11, 2004
Messages
3,954
Gender
Male
HSC
2003
not directly helping, but use <code> </code>, replacing > and < with ] and [.

makes code much easier to read. :)
 

dumarab

Member
Joined
Aug 16, 2007
Messages
260
Gender
Male
HSC
2008
AntiHyper said:
I need to know for my work project since we're meant to create an array of driver licenses and their properties.
currently i'm just guessing:

type licenseRec = record
licId:integer;
firstName:string[16];
<<stuff here too much to write up>>
end;
var drivers:array[1..32]of licenseRec;
...

And to copy a bit of info from array 'c' into a 'str':

str:=drivers[c].firstName;

In C i found out that you need a pointer. Maybe for Pascal aswell but i haven't taught of var ptr:pointer;

Hey mate, from what i see you have got it all right. But you said array c??? c is only the index.
So i really can't understand what your doing, whats the error your getting.

Btw no pointers needed, pascal has garbage collection anyway
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top