-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvarad.c
More file actions
58 lines (58 loc) · 794 Bytes
/
varad.c
File metadata and controls
58 lines (58 loc) · 794 Bytes
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
#include<stdio.h>
#include<string.h>
int top=-1;
int i;
int size=10;
int l;
char a[10];
char STK[10];
int full()
{
if(top==(size-1))
return 1;
else
return 0;
}
int empty()
{
if(top==-1)
return 1;
else
return 0;
}
void push()
{
if(full())
printf("Stack is full\n");
else
{
for(i=0;i<l;i++)
{
top++;
STK[top]=a[i];
}
}
}
int pop()
{
if(empty())
printf("Stack is empty\n");
else
{
for(i=0;i<l;i++)
{
a[i]=STK[top];
top--;
printf("%c\n",a[i]);
}
}
}
int main()
{
printf("Enter your String\n");
scanf("%s",a);
l=strlen(a);
push();
pop();
return 0;
}