+ Reply to Thread
Results 1 to 3 of 3
Like Tree4Likes
  • 1 Post By aoi
  • 3 Post By Mitti

Thread: Stack implementation Delphi

  1. #1
    Junior Member
    Join Date
    Dec 2011
    Location
    Germany
    Posts
    7

    Stack implementation Delphi

    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

  2. #2
    aoi
    aoi is offline
    Senior Member aoi's Avatar
    Join Date
    May 2008
    Location
    JP
    Posts
    847
    Article Entries
    1
    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.
    cracksman likes this.

    知る者は言わず、言う者は知らず。

  3. #3
    Senior Member Mitti's Avatar
    Join Date
    Nov 2009
    Posts
    104
    sounds like school homeworks
    aoi, counterstrikewi and StaTiX like this.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. sha-1 - hash implementation, HELP!
    By Guy in forum C/C++ Help
    Replies: 8
    Last Post: 27-11-2011, 02:59
  2. stack around variable 't' was corrupted.
    By Necrophilia in forum C/C++ Help
    Replies: 2
    Last Post: 17-08-2011, 08:25
  3. [C++] My Pos (from Delphi) implementation
    By Quqaa in forum General Programming Help
    Replies: 5
    Last Post: 08-08-2011, 10:02
  4. get stack of remote process?
    By opc0de in forum Delphi Help
    Replies: 3
    Last Post: 09-08-2010, 21:33
  5. Execution from Stack
    By binary in forum General Programming Help
    Replies: 8
    Last Post: 27-09-2009, 14:49

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 ©2011, Crawlability, Inc.