Because d.headlink is a pointer to a record, and has not been created with New.
pritaeas
Posting Expert
5,480 posts since Jul 2006
Reputation Points: 653
Solved Threads: 874
In add you do it right: use New and then set employee name etc. In createdir you try the same with creating memory for a new record, so the headlink points to nothing, hence the crash.
pritaeas
Posting Expert
5,480 posts since Jul 2006
Reputation Points: 653
Solved Threads: 874
No, I think if you use:
with d.dir_head^ do
it will compile.
pritaeas
Posting Expert
5,480 posts since Jul 2006
Reputation Points: 653
Solved Threads: 874