linux虚拟机运行c程序命令
gcc -o 文件名.out 文件名.c
./文件名.out
示例:
假设你有一个名为 "hello.c" 的 C 代码文件,其内容为:
c
include
int main() {
printf("Hello, world!\n");
return 0;
}
编译和运行步骤:
1. 编译:
gcc -o hello.out hello.c
2. 运行:
./hello.out
这将输出:
Hello, world!
gcc -o 文件名.out 文件名.c
./文件名.out
gcc -o hello.out hello.c
./hello.out