zoukankan      html  css  js  c++  java
  • C语言小实例—hello,world!

    运行环境

    操作系统:GUN/Linux CentOS 8.1
    编译器:gcc (GCC) 8.3.1 20190507 (Red Hat 8.3.1-4)

    代码

    在当前目录下递归创建Learnning_record/C_Code/下个day的子目录

    [hx@centos8 ~]$ mkdir -p ./Learnning_record/C_Code/day{1,2,3,4,5,6,7}
    

    使用vim在Learnning_record/C_Code/day1/下创建(打开)hello.c文件

    [hx@centos8 ~]$ vim ./Learnning_record/C_Code/day1/hello.c
    

    命令行模式下按i键进入插入模式,输入

    #include <stdio.h>
    int main()
    {
            printf("Hello,world!
    ");
            return 0;
    }
    
    

    之后按ESC键返回命令行模式,输入:x保存退出

    使用cd切换至./Learnning_record/C_Code/day1/下

    [hx@centos8 ~]$ cd ./Learnning_record/C_Code/day1/
    

    ls查看当前目录下所有文件

    [hx@centos8 day1]$ ls
    hello.c
    

    编译

    使用gcc编译器编译hello.c生成可执行文件hello

    [hx@centos8 day1]$ gcc hello.c -o hello
    

    运行结果

  • 相关阅读:
    “Metro”,移动设备视觉语言的新新人类
    三个排序
    window.location.reload;刷新
    2012年7月4日
    PDO基础(一)
    php数组
    smarty(原理概述)
    php函数
    jquery Poshy Tip
    WAMP:PHP基础(一)
  • 原文地址:https://www.cnblogs.com/hxlinux/p/13167233.html
Copyright © 2011-2022 走看看