RosettaCodeData/Task/Arrays/Action-/arrays.action

61 lines
1.2 KiB
Plaintext

PROC Main()
BYTE i
;array storing 4 INT items with initialized values
;negative values must be written as 16-bit unsigned numbers
INT ARRAY a=[3 5 71 65535]
;array storing 4 CARD items whithout initialization of values
CARD ARRAY b(3)
;array of BYTE items without allocation,
;it may be used as an pointer for another array
BYTE ARRAY c
;array of 1+7 CHAR items or a string
;the first item stores length of the string
CHAR ARRAY s="abcde"
PrintE("Array with initialized values:")
FOR i=0 TO 3
DO
PrintF("a(%I)=%I ",i,a(i))
OD
PutE() PutE()
PrintE("Array before initialization of items:")
FOR i=0 TO 3
DO
PrintF("b(%I)=%B ",i,b(i))
OD
PutE() PutE()
FOR i=0 TO 3
DO
b(i)=100+i
OD
PrintE("After initialization:")
FOR i=0 TO 3
DO
PrintF("b(%I)=%B ",i,b(i))
OD
PutE() PutE()
PrintE("Array of chars. The first item stores the length of string:")
FOR i=0 TO s(0)
DO
PrintF("s(%B)='%C ",i,s(i))
OD
PutE() PutE()
PrintE("As the string:")
PrintF("s=""%S""%E%E",s)
c=s
PrintE("Unallocated array as a pointer to another array. In this case c=s:")
FOR i=0 TO s(0)
DO
PrintF("c(%B)=%B ",i,c(i))
OD
RETURN