在我们的印象中,C代码是需要经过编译链接后才能运行的,因为C是编译型语言。
不像bash等脚本语言,即改即用,不需要编译。
现在,使用Tiny CC可以做到这点了。把C代码当做脚本来运行。
Tiny CC的全称是Tiny C Compiler. 是GNU/Linux下的自由软件。使用debian/ubuntu的用户可以通过”sudo apt-get install tcc”来体验一把。
安装完后,写一段最简单的代码来测试一下:
$ vi hello.c
------------------
#!/bin/usr/tcc -run
#include
void main()
{
printf("hello, world!\n");
}
------------------
$ chmod +x hello.c
$ ./hello.c
相当cool!
关于Tiny CC的详细介绍,请看点这里