/*linked list implementation of stacks*/

#include<stdio.h>
#include<conio.h>
struct stack
{
int no;
struct stack *next;
}
*start=NULL;
typedef struct stack st;
void push();
int pop();
void display();
void main()
{
char ch;
int choice,item;
do
{
clrscr();
printf("\n 1: push");
printf("\n 2: pop");
printf("\n 3: display");
printf("\n Enter your choice");
scanf("%d",&choice);
switch (choice)
{
case 1: push();
break;
case 2: item=pop();
printf("The delete element in %d",item);
break;
case 3: display();
break;
default : printf("\n Wrong choice");
};
printf("\n do you want to continue(Y/N)");
fflush(stdin);
scanf("%c",&ch);
}
while (ch=='Y'||ch=='y');
}
void push()
{
st *node;
node=(st *)malloc(sizeof(st));
printf("\n Enter the number to be insert");
scanf("%d",&node->no);
node->next=start;
start=node;
}
int pop()
{
st *temp;
temp=start;
if(start==NULL)
{
printf("stack is already empty");
getch();
exit();
}
else
{
start=start->next;
free(temp);
}
return(temp->no);
}
void display()
{
st *temp;
temp=start;
while(temp->next!=NULL)
{
printf("\nno=%d",temp->no);
temp=temp->next;
}
printf("\nno=%d",temp->no);
}

 

/*output of the program*/
1. PUSH
2. POP
3. DISPLPAY
Enter your choice
1
eneter the element to be inserted
2
do you want to contniue(y/n)
y

1. PUSH
2. POP
3. DISPLPAY
Enter your choice
2
deleted element is
2
do you want to contniue(y/n)
y

 

1. PUSH
2. POP
3. DISPLPAY
Enter your choice
2
deleted element is
2
do you want to contniue(y/n)
n

 

Home       |      About Us       |     Portfolio       |      Services       |       Career        |    Contact Us       |      Industrial Training        |      Achievement 
Corporate Services
  Web Design and development
  Web Promotion (SEO)
  Multimedia/CD Presentation
  Software development

  E.Commerce

Training@balujalabs

  Software Courses
  Hardware Courses
  Networking.Courses
  Mobile Repairing Courses
  UGC Degrees
Student Corner
 Programming & Projects
 Placement Papers
 Project Ideas
 Synopsis Ideas

  Franchise Section

 Administrator
Franchise Inquiry
 
 

Program to demonstrate the linked implementations of stacks

 

 

 

 

 

 

 

 

 

                                                                                                                                          

1 Program to demonstrate the operation performed on stack.
2 Program to demonstrate the linked implementations of stacks.
3 Program to input infix expression and convert it into an equivalent postfix expression.
4 Program to convert infix expression to prefix and postfix from using stack.
5 Program to accept a postfix expression ask the values for variables of the expression by the uses and then calculate the expression for that values.

 

     
Home       |      About Us       |     Portfolio       |      Services       |       Career        |    Contact Us       |      Industrial Training        |      Achievement