/**
#include<stdio.h>
int stack[5]={};
int top=0; // 데이터가 들어갈 위치
void push(int k)
{ if(is_full_stack()==1)
{
printf("FULL:(\n");
return ;
}
stack[top]=k;
top++;
}
int pop()
{
if(is_empty_stack())
{
printf("EMPTY:(\n");
return -1;
}
top--;
return stack[top];
}
int is_full_stack()
{
return top==5;
}
int is_empty_stack()
{
return top==0;
}
void view()
{
printf("stack : [ ");
for(int p=0;p<top;p++)
printf("%d ",stack[p]);
printf("]\n");
}
int main()
{
int k=0;
int n;
for(;;) {
printf("\n1:input\n2:output\n3:view\n...>>>");
scanf("%d", &n);
if(n==1) {
printf("INPUT NUMBER:");
scanf("%d", &k);
push(k);
}
else if(n==2){
k=pop();
if(k!=-1)
printf("OUTPUT NUMBER is %d\n",k );
}
else if(n==3) {
printf("View Is\n");
view();
}
else{
printf("Input Error, again InputNumber\n");
}
}
//while(스택이 비어있지않다면)
while(top!=0)
{
pop();
}
return 0;
}
#include<stdio.h>
int stack[1001]={}; // stack[0] ~ stack[1000]
int top=0;
void push(int h ) // stack에 h값을 넣으세요
{
if(top==1000)//스택이 가득찼는지?
{
return;
}
stack[top]=h;
top++;
}
int pop() //스택의 맨 위 데이터 값 리턴
{
if(top==0)//스택이 비었는지?
{
return 1;
}
top--;
return stack[top];
}
int reverse()
{
}
int main()
{
int a,i,h,n;
scanf("%d",&a);
for(i=0;i<a;i++)
{
scanf("%d",&h);
push(h);
}
while(top!=0)
{
n=pop();
printf("%d ",n);
}
}
#include<stdio.h>
#include<string.h>
char stack[51]={};
int top=0;
char sum;
void push(char k)
{
if(top==51)
{
return;
}
stack[top]=k;
top++;
}
char pop()
{
if(top==0)
{
return 1;
}
top--;
return stack[top];
}
int main()
{
char str[51]={};
scanf("%s",str);
for(int i=0;str[i]!=NULL;i++)
{
push(str[i]);
}
while(top!=0)
{
sum=pop();
printf("%c",sum);
}
}**/