RosettaCodeData/Task/Memory-allocation/M2000-Interpreter/memory-allocation.m2000

14 lines
426 B
Plaintext

Module Checkit {
Buffer Clear Mem1 as Byte*12345
Print Len(Mem1)
Hex Mem1(0) ' print in Hex address of first element
Print Mem1(Len(Mem1)-1)-Mem1(0)+1=12345
Buffer Mem1 as Byte*20000 ' redim block
Print Mem1(Len(Mem1)-1)-Mem1(0)+1=20000
Try {
Print Mem1(20000) ' it is an error
}
Print Error$ ' return message: Buffer Locked, wrong use of pointer
}
Checkit