#include <stdio.h>
void printLine(); //함수 선언
void add();
void printStar();
void name();

int main() {
    //내장 함수 : C언어에서 미리 만들어져 있는 함수

    /*사용자 정의 함수
    // 함수 선언
    void 함수이름();

    // 함수 정의
    void 함수이름() {
        함수의 명령;
    }

    // 함수 호출 : main안에 있어야 한다
    함수이름();
    */

    printLine(); //함수 호출
    add();
    printStar();

    printLine();
    name();
    printLine();
    return 0;
}

void printLine() { //함수 정의
    printf("===========\n");
}

void add() {
    int a = 21, b = 1;
    printf("%d\n", a + b);
}

void printStar() {
    printf("**********\n");
}

void name() {
    char n[10];
    scanf("%s", n);
    printf("이름 : %s\n", n);
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: