RosettaCodeData/Task/Variable-size-Set/XPL0/variable-size-set.xpl0

14 lines
600 B
Plaintext

include c:\cxpl\codes; \intrinsic 'code' declarations
string 0; \use zero-terminated strings
char S,
A(1), \sets up an array containing one byte
B(0); \sets up an array containing no bytes
int I;
[S:= ""; \a zero-length (null) string
A:= Reserve(1); \sets up a 1-byte array at runtime
B:= Reserve(0); \sets up a 0-byte array at runtime
I:= I ! 1<<3; \stores a single 1 bit into an integer
I:= I & ~(1<<29); \stores a 0 bit into bit 29 of the integer
IntOut(0, I>>3 & 1); \displays value of bit 3
]