简体   繁体   中英

pascal - How pass record key as a procedure parameter?

i have little issue with record + procedure in pascal. I have declared record as a Type and i want this record key as a parameter in procedure

Here is record structure & declaration:

person = record
  name:string[20];
  age:integer;
end;

var x:person

and i have this procedure, I DO NOT KNOW WHAT INSERT IN PARAMETER :

procedure out(param);
begin
  writeln(param);
end;

and calling procedure in main body of program:

x.name := 'Obama';
x.age := 35;

out(x.name);
out(x.age);

how to access to certain key of record and how to pass it in parameter ? thanks

procedure out(param:person);
begin
  writeln(param.name);
  writeln(param.age);
end;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM