33 lines
831 B
Plaintext
33 lines
831 B
Plaintext
DEF AList:POINTER
|
|
|
|
AList=ListCreate()
|
|
|
|
'Add items to the list.
|
|
DEF X:INT
|
|
|
|
FOR X=0 TO 10
|
|
POINTER Temp=ListAdd(AList,NEW(INT,1))
|
|
#<INT>temp=X
|
|
'The hash ("#") dereferencing operator is unique to IWBASIC and Creative Basic, and
|
|
'it is suitable for most basic pointer needs. IWBASIC also supports a "C style"
|
|
'dereferencing operator: "*". And that will work here too.
|
|
NEXT X
|
|
|
|
'A program compiled as console only does not need the commands to open and
|
|
'close the console. However, it does not hurt to use them.
|
|
OPENCONSOLE
|
|
|
|
'***Iterate the list with the "for each" loop***
|
|
FOR Temp=EACH AList AS INT
|
|
PRINT #Temp
|
|
NEXT
|
|
|
|
PRINT
|
|
|
|
'A press any key to continue message is automatic in a program compiled as a console only
|
|
program. I presume the compiler inserts the code.
|
|
CLOSECONSOLE
|
|
|
|
'Because this is a console only program.
|
|
END
|