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:表示无参

 posted on 2015-09-25 14:18  Just_Do  阅读(697)  评论(0编辑  收藏  举报