I have a code written in Pascal. I have a record type called recordPembeli and I have an array[1..x] of recordPembeli. The x in this array will be the length of the data which the user determines in the body of program readln(x).
Here is the program:
program iniSesiDua;
uses crt;
type
recordPembeli = record
nama : string[5];
jumlahPembelian : integer;
end;
var
x : integer
dataPembelian : array[1..x] of recordPembeli;
begin
clrscr;
write('Masukkan jumlah pembeli : ');readln(x);
readln;
end.
I try it and it says :
Warning: Variable "x" does not seem to be initialized
Error: Can't evaluate constant expression
Can I even determine the length of the data by user input in array of record or is it forbidden?