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

#include <stdio.h>

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


 

2、编译:

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

     C语言第一个例子hello world

 

【代码讲解】

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

main:表示程序入口

void:表示无参

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-24
  • 2021-11-02
  • 2022-01-30
  • 2021-08-31
  • 2022-12-23
猜你喜欢
  • 2021-12-29
  • 2022-12-23
  • 2021-06-14
  • 2022-12-23
  • 2022-01-09
  • 2021-06-24
  • 2021-07-23
相关资源
相似解决方案