RosettaCodeData/Task/Memory-allocation/Bracmat/memory-allocation.bracmat

11 lines
536 B
Plaintext

( alc$2000:?p {allocate 2000 bytes}
& pok$(!p,123456789,4) { poke a large value as a 4 byte integer }
& pok$(!p+4,0,4) { poke zeros in the next 4 bytes }
& out$(pee$(!p,1)) { peek the first byte }
& out$(pee$(!p+2,2)) { peek the short int located at the third and fourth byte }
& out$(pee$(!p,4)) { peek the first four bytes }
& out$(pee$(!p+6,2)) { peek the two bytes from the zeroed-out range }
& out$(pee$(!p+1000,2)) { peek some uninitialized data }
& fre$!p { free the memory }
&);