本帖最后由 edisonx 于 2012-11-11 22:38 编辑
回复 20# seeyou
雛型約莫如此 < 沒正式做測試 >
$tagLink = "int;ptr"
Dim $Head = DllStructCreate ($tagLink)
Dim $Second = DllStructCreate ($tagLink)
DllStructSetData($Head, 1, 10)
DllStructSetData($Head, 2, DllStructGetPtr($Second) ) ; Head->Next = Second
DllStructSetData($Second, 1, 20)
DllStructSetData($Second, 2, 0) ; Second->Next = NULL
; ------------------------------------------------
ConsoleWrite( StringFormat("\nData Of Head : %d\n", DllStructGetData($Head, 1)))
ConsoleWrite( StringFormat("Next Of Head : 0X%08x\n\n", DllStructGetData($Head, 2)))
ConsoleWrite( StringFormat("Addr(Second) : 0X%08x\n", DllStructGetPtr($Second)))
ConsoleWrite( StringFormat("Data Of Second : %d\n", DllStructGetData($Second, 1)))
ConsoleWrite( StringFormat("Next Of Second : 0X%08x\n\n", DllStructGetData($Second, 2)))
執行結果
Data Of Head : 10
Next Of Head : 0X01973590
Addr(Second) : 0X01973590
Data Of Second : 20
Next Of Second : 0X00000000
如您所見,非常不便。欲做 PushFront、PushBack、Travel 需花點時間。
[補充] AU 之記憶體 (內存,memory) 管理都是自己來的,在裡頭用 link-list 意義似乎不大便是。 |