你所有的函数都是 void 属性,那么你就只能返回 void 属性的值。
好吧,我知道 void 其陆渣实是没有值的……
-------------
你没 Linux 在这瞎折腾厅档什么?装个 Linux 很难?
jiangtao@Gentoo ~/asdasdasd $ gcc a.c
a.c: 在函数‘CLIENT’中:
a.c:21: 警告:隐式声明与内建函数‘exit’不兼容
a.c: 在函数‘SERVER’中:
a.c:32: 警告:隐式声明与内建函数‘exit’不兼容
jiangtao@Gentoo ~/asdasdasd $
a.c 就是扮悉乱你的程序文件
jiangtao@Gentoo ~/asdasdasd $ ./a.out
(client)sent
(client)sent
(client)sent
(client)sent
(client)sent
(client)sent
(client)sent
(client)sent
(server)received
(server)received
(server)received
(server)received
(server)received
(server)received
(server)received
(server)received
(client)sent
(server)received
(client)sent
(server)received
jiangtao@Gentoo ~/asdasdasd $
-----------------
你现在没 Linux 没 GCC 根本没办法继续。至少你写程序,努力写一个连 waring 都没有的源代码。
1、打开kali linux的终端。创建一个文件并命名为test.c。在终端输入:touch test.c。
2、可以看到已经生成了一个后缀为test.c的源文件。然后用vim工具打开这个文件并编写代码。在终端中输入:vim test.c或者gvim test.c打开这个文件并编写代码。
3、编写完了这个代码。现在开始编译源文件。在终端中输入:gcc test.cgcc是linux自带的c语言编译器。迅键迟如果是windows则要用ide工具来编译。linux系统一般写C语言用gcc +vim+gdb三个自带的工具就可以了。
4、打完gcc test.c编译完C源文件。然后就可以看见a.out的文件。一般linux系统就默认为a.out为编译完的文件。现在运行a.out文件。在a.out文件的目录下打开终端并输入./a.out就是运行文件了亩李。
5、如果想要编译完的文件名不要用a.out文件。就可以在编译时打入.gcc test.c -o test.out然后就可以看见有一个test.out.文件 了。-o后面跟着的编译生成的文件名亮清。
6、再运行test.out在终端中输入./test.out结果如图。这样在linux系统下编译并运行C语言就完成了。
不妨试试 ctrl-c。
linux下:ctrl-c 发送 SIGINT 信号给前台进程组中的所有进程。常用于终止正在运行的程序。
ctrl-z 发送 SIGTSTP 信号给前台进程组中的所有进程,常用于挂起一个进程。
ctrl-d 不是发送信号,而是表示一个特殊的二进制值,表示 EOF。
ctrl-/ 发胡悔亮送 SIGQUIT 信号给前台进程组中的所有进程,终止前台进程并生成 core 文件。
Key Function
ctrl-c Kill foreground process 前高
ctrl-z Suspend foreground process
ctrl-d Terminate input, or exit shell
ctrl-s Suspend output
ctrl-q Resume output
ctrl-o Discard output
ctrl-l 裤宽Clear screen
用stty -a看看终端配置。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)