Can somebody write a stack implementation in Delphi? Pointers should be used ...
There should be the possibility to push and to pop.
Hope you can help me![]()
Can somebody write a stack implementation in Delphi? Pointers should be used ...
There should be the possibility to push and to pop.
Hope you can help me![]()
here is a very simple implementation in vb so u can see how it basically work...
Code:Private data() As Variant Private pointer As Long Public Function Pop() If pointer > 0 Then Pop = data(pointer) pointer = pointer - 1 Else Pop = Null End If End Function Public Sub Push(value) pointer = pointer + 1 If UBound(data) < pointer Then ReDim Preserve data(pointer) End If data(pointer) = value End Sub snip by P.Aitken
Last edited by aoi; 24-01-2012 at 03:44.
知る者は言わず、言う者は知らず。
There are currently 1 users browsing this thread. (0 members and 1 guests)