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: Wed, 11 Mar 2026 06:27:18 -0700
Organization: A noiseless patient Spider
Lines: 63
Message-ID: <86h5qma43t.fsf@linuxsc.com>
References: <10n80sc$3soe4$1@dont-email.me> <86v7feei2e.fsf@linuxsc.com> <10o53k6$1i0ef$2@dont-email.me> <86ms0peby6.fsf@linuxsc.com> <10ockdh$3qpk6$1@dont-email.me> <10ocrjn$3qpk6$2@dont-email.me> <10od64s$3qpk6$4@dont-email.me> <86ikb9bmtw.fsf@linuxsc.com> <10oem5t$n5hk$1@dont-email.me> <86o6kz9zng.fsf@linuxsc.com> <10oi72k$1rss6$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Date: Wed, 11 Mar 2026 13:27:24 +0000 (UTC)
Injection-Info: dont-email.me; posting-host="5f44bcdbc02769ce6998caa4a4cb2206"; logging-data="1172321"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/KFqCRQr7VwYhZP8+znUYEqlEU68HVuns="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:xfJt6DvzqVXjmGYaDzDqKR5Ccf0= sha1:VlcuRwjBPiv5wnV0DTJrATBclAI=
Xref: csiph.com comp.lang.c:396900
DFS writes:
[some of posting being responded to has been taken out
without further notice].
> On 3/7/2026 3:02 PM, Tim Rentsch wrote:
>
>> Lew Pitcher writes:
>>
>>> [...] I look forward to seeing /your/ code :-)
>>
>> Here we go...
>
> OMG! Congrats on an innovative piece of C code. Never seen
> anything like it.
Thank you, that's always nice to hear.
> I don't understand everything yet, but nested ternaries aside, it's
> pretty easy to follow too.
Once you get used to them I think you'll find conditional
expressions are easier to follow than if() chains.
> A nit you may have forgotten: you earlier said main() was not
> allowed:
No, I didn't. You asked "Is main() OK?". I replied "Yes" followed
by a short elaboration. Having main() be present is okay; calling
it is not. The oversight was not mentioning that main is allowed.
> Also I have a 'challenge' to add to your program - that I already
> added to mine - to make it even more compelling:
>
> * when looking for a square matrix, instead of printing 'no joy'
> print out a matrix that will visually demonstrate why the number
> doesn't fit in a square matrix.
>
> For instance:
>
> ./rc-dfs 17
> square matrix for 1-17 not possible
> --------------------
> 1 2 3 4 5
> --------------------
> 1 6 11 16
> 2 7 12 17
> 3 8 13
> 4 9 14
> 5 10 15
>
> If you get stuck, I'll give you a hint :)
A straightforward exercise. A challenge for you is to start with my
program and adapt it, writing in the same style, to add this
functionality. Now that you have seen my example code I think you
should be able to adapt it without too much difficulty.
> What do you think would be the reaction in a corporate programming
> dept to this unique kind of code?
What characteristics or properties would you say are the salient
ones for the question you're asking?