- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharrayread.c
More file actions
Latest commit
63 lines (58 loc) · 1.16 KB
/
Copy patharrayread.c
File metadata and controls
63 lines (58 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include<stdio.h>
#include<stdlib.h>
ints[50],max,top=-1;
voidpop()
{
if(top==-1)
{
printf("stack underflow");
}
else
{
printf("%d",s[top]);
top--;
}
}
voidpush(intvalue)
{
if(top>=max-1)
{
printf("Stack overflow");
}
else
{
top++;
s[top]=value;
}
}
voidmain()
{
intch,i,n;
printf("Enter the limit of the array:");
scanf("%d",&max);
while(1)
{
printf("1.Insert an element");
printf("2.Delete an element");
printf("3.Display");
printf("4.Exit");
printf("Enter your choice:");
scanf("%d",&ch);
switch(ch)
{
case1:printf("Enter the value you wish to input:");
scanf("%d",&n);
push(n);
break;
case2:pop();
break;
case3:printf("Array");
for(i=0;i<top;i++)
{
printf("%d",s[i]);
}
break;
case4:exit(0);
}
}
}