C语言第一个例子hello world

1、用文本编辑器编辑代码如下,然后保存为hello.c文件

#include <stdio.h>

int main(void){
    printf("hello world");
    return 0;
}


 

2、编译:

  用命令gcc hello.c -o helle 编译后会出现一个hello.exe的可执行文件,通过命令执行该文件就可以看到运行代码  

    

【代码讲解】

#include <stdio.h>:符号#表示这是一个预处理命令,它告诉编译器在编译代码之前需要先执行一些操作。在上面的例子中,编译器要将stdio.h文件类容包含进来,因为printf函数被包含在stdio.h这个文件中

main:表示程序入口

void:表示无参

原文地址:https://www.cnblogs.com/caoyc/p/4838070.html