// 중위 표기 수식 -> 후위 표기 수식
void infix_to_postfix(char exp[])
{
int i=0;
char ch, top_op;
int len=strlen(exp);
StackType s;
init(&s); // 스택 초기화
for(i=0; i ch = exp[i];
// 연산자이면
switch(ch){
case \'+\': case \'-\': case \'*\': case \'/\': // 연산자
// 스택에 있는 연산자의 우선순위가 더 크거나 같으면 출력
while(!is_empty(&s) && (prec(ch) <= prec(peek(&s))))
printf(\"%c\", pop(&s));
push(&s, ch);
break;
case \'(\': // 왼쪽 괄호
push(&s, ch);
break;
여기서 case \'+\': case \'-\': case \'*\': case \'/\': // 연산자
이거 +면 케이스- 호출하고 -니까 ×호출하고 x기니까 /호출하고
이렇게 꼬리를 물면서 호출하는거임?
void infix_to_postfix(char exp[])
{
int i=0;
char ch, top_op;
int len=strlen(exp);
StackType s;
init(&s); // 스택 초기화
for(i=0; i ch = exp[i];
// 연산자이면
switch(ch){
case \'+\': case \'-\': case \'*\': case \'/\': // 연산자
// 스택에 있는 연산자의 우선순위가 더 크거나 같으면 출력
while(!is_empty(&s) && (prec(ch) <= prec(peek(&s))))
printf(\"%c\", pop(&s));
push(&s, ch);
break;
case \'(\': // 왼쪽 괄호
push(&s, ch);
break;
여기서 case \'+\': case \'-\': case \'*\': case \'/\': // 연산자
이거 +면 케이스- 호출하고 -니까 ×호출하고 x기니까 /호출하고
이렇게 꼬리를 물면서 호출하는거임?
Case : case : case: 이거 먼뜻인지 진짜 몰것네
if (ch == \'+\' || ch == \'-\' || ch == \'*\' || ch == \'/\') ...와 같음
ㅇㅋ 이해됨 땡큐
break 없으면 걍 계속 실행.
그냥 조건줄수있는 레이블이라고 생각하면 편해요.
case안에 case라서 뭔가 했넹. ㅇㅇ