用C语言写一个Helloworld_实现第一步编译运行

编写第一个hello world

创建helloworld.c

// 程序头文件
#include <stdio.h>

// 主入口函数
int main(int arc, char* argv[])
{
  printf("Hello World!\n");
    return 0;
}

编译自己的第一个程序

  • Mac os
    • clang -g -o hellword helloword.c
    • -g: 是输出调试信息
    • -o: 是输出可执行程序
    • hellword: 最终生成的文件名称
    • helloword.c: 指定编译的文件
  • Linux
    • gcc -g -o hellword hellword.c
    • -g: 是输出调试信息
    • -o: 是输出可执行程序
    • hellword: 最终生成的文件名称
    • helloword.c: 指定编译的文件

猜你喜欢

转载自www.cnblogs.com/fandx/p/12122779.html
今日推荐