Path: csiph.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail From: Tim Rentsch Newsgroups: comp.lang.c Subject: Re: Sort of trivial code challenge - may be interesting to you anyway Date: Mon, 02 Mar 2026 21:09:21 -0800 Organization: A noiseless patient Spider Lines: 28 Message-ID: <86ms0peby6.fsf@linuxsc.com> References: <10n80sc$3soe4$1@dont-email.me> <86v7feei2e.fsf@linuxsc.com> <10o53k6$1i0ef$2@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Date: Tue, 03 Mar 2026 05:09:25 +0000 (UTC) Injection-Info: dont-email.me; posting-host="9dc790098ce30bad4f358538e3d50880"; logging-data="1839364"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/s0lOxcJ7GiBXBsPjqn33HANntuK97hnQ=" User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux) Cancel-Lock: sha1:8APVrUOiEYvIC5g97A4Cni+6lbY= sha1:nmP8+cJN/E8Ih7pIJlXdTHPqhYM= Xref: csiph.com comp.lang.c:396733 DFS writes: > On 3/2/2026 3:44 AM, Tim Rentsch wrote: > >> DFS writes: >> >> >> A straightfoward exercise. Here is a counter challenge to make >> things more interesting: as above, but don't use nested loops >> (or goto's, etc). > > Done. > > Does everything in my original challenge, but with no loops: > no for.. while.. do.. goto.. or recursion. Unfortunately the two functions generate() and validate() are mutually recursive. They may be optimized to use tail-call elimination, but at the source level they are recursive. The latest challenge, which I just got through doing, is to disallow if, for, while, goto, return, and to forbid functions and function calls except for calls to C standard library functions. Also no math library. :) The program is a bit on the long side because of argument processing but the matrix print code is less than 20 lines, including 5 blank lines.