954,529 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Push Procedure

i make push procedure but its not working, there something wrong with my code??
please see my following push procedure :

procedure PUSH (var T: Stack; var Full: boolean;
                     X: integer);
 begin
   if T.Top = MaxElemen then
       Full := true
   else
      begin
        
        T.Top := inc(T.Top);
        T.Contain[T.Top] := X
      end
 end;
Vega_Knight
Light Poster
36 posts since Feb 2008
Reputation Points: 18
Solved Threads: 0
 

i think you forget to set full = false, just it.
add this code after else :

begin
        Full := false;
        T.Top := inc(T.Top);
        T.Contain[T.Top] := X
      end

ok hope this helps..

Jx_Man
Nearly a Senior Poster
3,329 posts since Nov 2007
Reputation Points: 1,372
Solved Threads: 444
 

oh...great. thanks jx_man. i feel dumb..just caused by a little think.

Vega_Knight
Light Poster
36 posts since Feb 2008
Reputation Points: 18
Solved Threads: 0
 

you're welcome. its ok, everybody can make mistake. happy coding friend :)
all for the best.

Jx_Man
Nearly a Senior Poster
3,329 posts since Nov 2007
Reputation Points: 1,372
Solved Threads: 444
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You