MySQL
Linux
Centos
Ubuntu
PHP
Windows
CSS3
帳號登入
MySQL
Linux
Ubuntu
CentOS
PHP
Windows
CSS3
編碼的世界 / 優質文選 /
生物
Linux下怎麼編譯並運行C程序
2022年3月23日
-
書箋
比如打印一個"hello world"
很簡單的代碼如下:
#include<stdio.h> #include<stdlib.h> int main() { printf("hello world
"); exit(0); }
我們先vim test.c
進入後把代碼寫進去
保存退出後在命令行輸入gcc -o test test.c
之後我們ls一下
發現目錄下多了一個名為test的可執行程序
我們再 ./test一下
輸出了結果hello world
熱門文章