Arrays

vmthread  MAIN
{
	// Have a handle to the array
	HANDLE hMyArray

	// Create the array
	ARRAY( CREATE16, 10, hMyArray )

	// Write 0 to first and second slot
	ARRAY_WRITE( hMyArray, 0, 0 )
	ARRAY_WRITE( hMyArray, 1, 0 )

	// Write 2 to third slot
	ARRAY_WRITE( hMyArray, 2, 2 )

	// Read back from the array
	DATA16 ReadData
	ARRAY_READ( hMyArray, 1, ReadData )

	// And free the memory
	ARRAY( DELETE, hMyArray )
}

Leave a Reply