473,499 Members | 1,539 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

stacks...

6 New Member
hi, can anyone give me the different stack functions...our teacher just gave us the bare bones, what the different functions do...but no sample code...thank you
Oct 4 '06 #1
3 1569
anushhprabu
43 New Member
hi, can anyone give me the different stack functions...our teacher just gave us the bare bones, what the different functions do...but no sample code...thank you
hi..
do you need the functions those can be done on stack or else the implementation of stack??

any way :-
Functions on stack are:
1. Push - to add element into stack
2. Pop - to remove TOP element from stack (FILO order)
3. IsFull -to check whether stack is full
4. IsEmpty - to check whether stack is empty.
(i think 3,4 are proper stack functions)

Implementation of stack:
(place where we can implement stack)
1. When function calll occurs (operands and controls are stored to stack)
2. for infix ,postfix notations..
3. all the places when you need to serve the last come first serve basis..
Oct 4 '06 #2
tyreld
144 New Member
hi, can anyone give me the different stack functions...our teacher just gave us the bare bones, what the different functions do...but no sample code...thank you
Stacks are pretty simple and most only have 3 or 4 functions.

Expand|Select|Wrap|Line Numbers
  1.  
  2. // These functions assume a stack that stores values of type int
  3.  
  4. int empty();  // Tests if the stack is empty
  5.  
  6. int peek(); // Returns the value on the top of the stack, but doesn't removei it.
  7.  
  8. int pop(); // Removes the value on the top of the stack and returns it
  9.  
  10. void push(int value);  // Pushes a value onto the top of the stack
  11.  
  12.  
Oct 4 '06 #3
belton180
6 New Member
ok thanks for the replies but that's not what i needed, our teacher gave us the functions but not what's in those functions, and it should be for char not int
Oct 5 '06 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

5
2599
by: Vanessa T. | last post by:
Hello All! Is there a place where I can learn stacks, (push and pop) etc. Thanks,
4
3192
by: Ice | last post by:
Hi there, I'm not sure if this is the right group for this- If it isn't, could anyone point me in the right direction? For our data structures exam, we are usually asked to implement the...
6
1657
by: Sathyaish | last post by:
I've searched Google and found a few, but I am not so satisfied. Any good reading on "stacks and heaps" about how and when memory is allocated from the heap?
18
1545
by: pmm | last post by:
Hi all, Plz dont fire at me if this is a silly question Is there any way to know in which direction stack grows pmm
1
1183
by: LedZep | last post by:
This program has to use a stack to determine whether a string is a palindrome (a string that is spelled identically backward and forward). The program has to ignore spaces, case sensitivity and...
10
2105
by: Rich Kucera | last post by:
Holding all versions at 5.0.4, Multiple stacks with multiple-version configurations inevitable Will have to wait to see what the impact of problems such as http://bugs.php.net/bug.php?id=33643 ...
2
4562
by: Daniel | last post by:
Hi, I have a question regarding the memory managment in stl stacks. I want to use stacks to store a very large amount of numbers (some millions), thus I'm interested in how the stack behaves...
2
5188
by: chubbykelly | last post by:
hi, i got a prob with the new topic my teacher in data struct taught us this afternoon. he introduced the concept of stacks. simulated how 5 elements will be pushed and popped out to the array...
0
2314
by: raghuveer | last post by:
i want to implement multiple stacks using arrays..I am able to create ,insert and print them but not poping an element form any of the stack..This is what i have #include<stdio.h>...
8
3909
by: cerise | last post by:
I can't figure out how to make and handle multiple stacks and use them so I could create four linked list stacks representing each suit of cards, one stack each for diamonds, hearts, spades, and...
0
7007
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7220
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7386
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5468
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4599
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3098
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3090
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
664
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
295
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.