0% found this document useful (0 votes)
6 views2 pages

59 Assignment 3

The document outlines an assignment for implementing a stack in C programming. It includes code snippets for stack operations such as push, pop, and display, along with a main function to initialize the stack. The author is Sanket Bhimapa Koli, with roll number 59 and PRN 2122000732.

Uploaded by

anishwarushe0725
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views2 pages

59 Assignment 3

The document outlines an assignment for implementing a stack in C programming. It includes code snippets for stack operations such as push, pop, and display, along with a main function to initialize the stack. The author is Sanket Bhimapa Koli, with roll number 59 and PRN 2122000732.

Uploaded by

anishwarushe0725
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

ASSIGNMENT 3

stack implementaton
name -SANKET BHIMAPA KOLI
roll no:-59
prn-2122000732

#include <stdio.h>
int stack [100],coice , n , top , x,i;
void push (void );
void pop(void);
void dispaly(void);
do
{
printf("enter choice of operation :");
scanf ("%d",&choice);
switch (choice ){
case 1:
pop();
break;
case 2:
push ();
break;
case 3:
display();
case 4:
printf("exit from stack ");
break;
default :
print("enter valid choice");
}
}while (choice!=4);
void push(){
if(top>=n-1){
printf("stack is full");
}else{
printf("enter element to be push:");
scanf ("%d",&n);
top++;
stack[top]=x;
}
}
void pop(){
if (top<=-1){
printf ("stack is empty");
}else{
printf("enter element to be push:");
scanf ("%d",&n);
top--;
stack[top]=x;
}
}
void display(){
if (top>=0){
printf("elements in stack are:");
for (i=top;i>=0;i--){
printf ("%d\n",stack[i]);

}
}else{
printf("stack is empty");
}
}
int main(){
top=-1;
printf("enter the size of stack[max=100:]");
scanf("%d" ,&n);

You might also like