标签:char* UI return 递归 local char put session cpp
以前听说main()不能递归?于是在CentOS7上使用gcc-8.1.0测试了一下,发现可行:
#include <stdio.h> int x = 5; int main(int argc, char**kw) { if (x < 1) return 0; printf("[%d]:%s\n", x, kw[x]); x--; return main(x, kw); }
Output:
$ ./test [5]:DBUS_STARTER_ADDRESS=unix:abstract=/tmp/dbus-WWhe2bAkPe,guid=043099e6ad5b1776b14ce3fe5b2867a3 [4]:HOSTNAME=localhost.localdomain [3]:XDG_SESSION_ID=1 [2]:XDG_VTNR=1 [1]:(null) [0]:./test
标签:char* UI return 递归 local char put session cpp
原文地址:https://www.cnblogs.com/darkchii/p/9197497.html