C语言学习-菜鸟教程C经典100例-练习34

题目

练习函数调用。


代码

#include <stdio.h>

// 函数声明
void hello_world(void){
    printf("Hello, world!\n");
}

void three_hellos(void){
    for(int i=1; i<=3; i++){
        hello_world(); // 调用 hello_world 函数
    }
}

int main(void){
    three_hellos(); // 调用 three_hellos 函数

    return 0;
}

输出结果

Hello, world!
Hello, world!
Hello, world!

更多推荐