/*#include <stdio.h>
int a[10001];
int n, i, j, temp, key;
int main()
{
scanf("%d", &n);
for (i=1; i<=n; i++)
scanf("%d", &a[i]);
for (i=2; i<=n; i++)
{
key=a[i];
if(a[1]>key)
{
temp=a[1];
a[1]=key;
key=temp;
}
for(j=1; j<=n-i+1; j++)
{
a[j+1]=a[j];
}
a[j+1]=key;
}
for (i=1; i<=n; i++)
printf("%d\n", a[i]);
return 0;
}
*/
/*
#include<stdio.h>
int main()
{
int n, i, j, temp, c=0, a[1000];
scanf("%d", &n);
for(i=1; i<=n; i++)
{
scanf("%d", &a[i]);
}
if(n==2)
{
if(a[1]>a[2])
printf("1");
else
printf("0");
return 0;
}
for(i=1; i<n; i++)
{
c=0;
for(j=1; j<=n-i; j++)
{
if(a[j]>a[j+1])
{
c=1;
temp=a[j];
a[j]=a[j+1];
a[j+1]=temp;
}
}
if(c==0)
{
printf("%d", i-1);
break;
}
}
return 0;
}
*/
/*
#include <stdio.h>
int main()
{
char str[10]="hello";
printf("str[0] = %c\n",str[0]);
printf("&str[0] = %d\n",&str[0]);
printf("*(str+1) = %c\n",*(str+1));
return 0;
}
*/
/*
#include<stdio.h>
char *mysubstr(char *str, int start, int count)
{
// 함수 처리부
}
int main()
{
char str[100]={};
int a, b, i;
scanf("%s",str);
scanf("%d %d", &a, &b);
char* pc=a;
char* pd=b;
for(i=*pc)
#include <stdio.h>
int main()
{
int a = 5;
int* pa = &a;
char* pc = &a;
printf("a = %d\n",a);
printf("&a = %d\n",&a);
printf("pa = %d\n",pa);
printf("*pa = %d\n",*pa);
printf("*pc = %d\n",*pc);
return 0;
}
}
#include<stdio.h>
void myswap(int* pa, int* pb)
{
int temp;
if(*pa>*pb)
{
temp=*pa;
*pa=*pb;
*pb=temp;
}
}
main()
{
int a, b;
scanf("%d%d", &a, &b);
myswap(&a, &b);
printf("%d %d", a, b);
}
#include<stdio.h>
char* mysubstr(char *str, int start, int count)
{
//str[start+count]='\0';
*(str+start+count)='\0';
return &str[start];
}
int main()
{
int a, b;
char str[101];
scanf("%s", str);
scanf(" %d %d", &a, &b);
printf("%s", mysubstr(str, a, b));
return 0;
}
#include<stdio.h>
void print_reverse(int* a, int n)
{
int* p = a+n-1;
while(p>=a)
{
printf("%d\n", *p);
p--;
}
}
int main(void)
{
int a[]={10, 20, 30, 40, 50};
print_reverse(a, 5);
return 0;
}
*/
//stack 마지막으로 들어온 데이터가 가장 먼저 나가는 구조
/*
#include <stdio.h>
#define SIZE 100
int stack[SIZE];
int top = -1; //데이터가 마지막으로 저장된 곳의 위치
void push(int data)
{
if(top==SIZE-1) return ;
stack[++top]=data;
}
int pop()
{
if(top==-1) return 0;
return stack[top--];
}
void view()
{
for( int i=0; i<=top;i++)
{
printf("%d ",stack[i]);
}
printf("\n");
}
int main()
{
push(3);
view();
push(4);
view();
push(5);
view();
printf("top = %d\n",top);
printf("pop = %d\n",pop());
view();
printf("top = %d\n",top);
printf("pop = %d\n",pop());
view();
printf("pop = %d\n",pop());
view();
}
*/