별의 공부 블로그 🧑🏻‍💻
728x90
728x170
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <stdio.h>
 
void recur_print(int n) {
    recur_print(10);
}
 
// 10 9 8 7 6 5 4 3 2 1
void recur_print(int n) {
    if (n > 0) {
        printf("%d ", n);
        recur_print(n-1);
    }
}
 
// 1 2 3 4 5 6 7 8 9 10
void recur_print(int n) {
    int a;
    if (n > 0) {
        recur_print(n-1);
        printf("%d ", n);
    }
}
cs

 

As you can see, if you put the part for recursion before you put the part for print, you can make the Ascending order function.

728x90
그리드형(광고전용)
⚠️AdBlock이 감지되었습니다. 원할한 페이지 표시를 위해 AdBlock을 꺼주세요.⚠️
starrykss
starrykss
별의 공부 블로그 🧑🏻‍💻


📖 Contents 📖