What could be the error

Incomparible types

with SetLength(stud,length(stud)+1) ?

 program Project2; {$APPTYPE CONSOLE} uses SysUtils, windows; type fullname = record surname:string; name: string; midname:string; end; fulldate = record day: integer; month:integer; year: integer; end; person = record fio: fullname; adress:string; born: fulldate; brain: double; end; var student: array of person; procedure newStud(var stud:array of person); begin SetLength(stud,length(stud)+1); ... end; 

    2 answers 2

     ... TArr = array of person; var student : TArr; x,max_len:integer; Procedure newStud(var stud:TArr); begin SetLength(stud,length(stud)+1); ... end; 
    • Alas, it did not help - 111xbot111 February
    • how not to write? - hovadur
    • But no, it's all right, thanks! Just before "TArr = array of person;" need to type write. And you can find out why? Or where to read about it? - 111xbot111
    • rvelthuis.de/articles/articles-openarr.html - see here why you cannot use SetLength to open array. - hovadur
    • I already figured it out. Just for the first time I ran into lists and thought that the array in this case would not be considered as open. And was wrong. - 111xbot111

    In my case, something like the following has passed:

      TArr = array of person; pArr = ^TArr; var student : TArr; x,max_len:integer; Procedure newStud(stud:pArr); begin SetLength(stud^,length(stud^)+1); ... end; 

    And accordingly the procedure call as

     newStud(@student); 

    though under TArr, I had TArr = array of double;