Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #396684 > unrolled thread

Sort of trivial code challenge - may be interesting to you anyway

Started byDFS <nospam@dfs.com>
First post2026-02-19 16:55 -0500
Last post2026-03-16 09:04 +0100
Articles 18 on this page of 218 — 21 participants

Back to article view | Back to comp.lang.c


Contents

  Sort of trivial code challenge - may be interesting to you anyway DFS <nospam@dfs.com> - 2026-02-19 16:55 -0500
    Re: Sort of trivial code challenge - may be interesting to you anyway jayjwa <jayjwa@atr2.ath.cx.invalid> - 2026-02-25 15:56 -0500
      Re: Sort of trivial code challenge - may be interesting to you anyway DFS <nospam@dfs.com> - 2026-02-26 10:05 -0500
        Re: Sort of trivial code challenge - may be interesting to you anyway jayjwa <jayjwa@atr2.ath.cx.invalid> - 2026-02-26 13:20 -0500
    Re: Sort of trivial code challenge - may be interesting to you anyway Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2026-02-26 17:06 +0000
      Re: Sort of trivial code challenge - may be interesting to you anyway Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2026-02-26 17:27 +0000
        Re: Sort of trivial code challenge - may be interesting to you anyway DFS <nospam@dfs.com> - 2026-02-26 14:31 -0500
      Re: Sort of trivial code challenge - may be interesting to you anyway jayjwa <jayjwa@atr2.ath.cx.invalid> - 2026-02-26 13:33 -0500
        Re: Sort of trivial code challenge - may be interesting to you anyway Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2026-02-26 18:49 +0000
          Re: Sort of trivial code challenge - may be interesting to you anyway Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2026-02-26 18:55 +0000
            Re: Sort of trivial code challenge - may be interesting to you anyway Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2026-02-26 19:17 +0000
      Re: Sort of trivial code challenge - may be interesting to you anyway Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2026-02-26 19:34 +0000
        Re: Sort of trivial code challenge - may be interesting to you anyway Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2026-02-26 20:01 +0000
        Re: Sort of trivial code challenge - may be interesting to you anyway DFS <nospam@dfs.com> - 2026-03-06 10:36 -0500
          Re: Sort of trivial code challenge - may be interesting to you anyway Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2026-03-06 17:38 +0000
            Re: Sort of trivial code challenge - may be interesting to you anyway Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2026-03-06 17:48 +0000
    Re: Sort of trivial code challenge - may be interesting to you anyway Bart <bc@freeuk.com> - 2026-02-27 00:12 +0000
      [OT] Bart's scripting language solution (was Re: Sort of trivial code challenge - may be interesting to you anyway) Janis Papanagnou <janis_papanagnou@hotmail.com> - 2026-03-06 06:37 +0100
        Re: [OT] Bart's scripting language solution (was Re: Sort of trivial code challenge - may be interesting to you anyway) Bart <bc@freeuk.com> - 2026-03-06 15:48 +0000
          Re: [OT] Bart's scripting language solution (was Re: Sort of trivial code challenge - may be interesting to you anyway) Janis Papanagnou <janis_papanagnou@hotmail.com> - 2026-03-06 18:17 +0100
            Re: [OT] Bart's scripting language solution (was Re: Sort of trivial code challenge - may be interesting to you anyway) Bart <bc@freeuk.com> - 2026-03-06 21:46 +0000
    Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-02 00:44 -0800
      Re: Sort of trivial code challenge - may be interesting to you anyway Michael S <already5chosen@yahoo.com> - 2026-03-02 11:07 +0200
        Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-02 06:35 -0800
          Re: Sort of trivial code challenge - may be interesting to you anyway Bart <bc@freeuk.com> - 2026-03-02 17:50 +0000
            Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-02 21:15 -0800
              Re: Sort of trivial code challenge - may be interesting to you anyway Bart <bc@freeuk.com> - 2026-03-03 20:48 +0000
                Re: Sort of trivial code challenge - may be interesting to you anyway Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2026-03-03 22:47 +0100
                  Re: Sort of trivial code challenge - may be interesting to you anyway David Brown <david.brown@hesbynett.no> - 2026-03-04 08:48 +0100
                    Re: Sort of trivial code challenge - may be interesting to you anyway Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2026-03-04 01:07 -0800
                      Re: Sort of trivial code challenge - may be interesting to you anyway Michael S <already5chosen@yahoo.com> - 2026-03-04 12:09 +0200
                        Re: Sort of trivial code challenge - may be interesting to you anyway Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2026-03-04 11:19 -0800
                      Re: Sort of trivial code challenge - may be interesting to you anyway David Brown <david.brown@hesbynett.no> - 2026-03-04 12:58 +0100
                        Re: Sort of trivial code challenge - may be interesting to you anyway Bonita Montero <Bonita.Montero@gmail.com> - 2026-03-11 11:31 +0100
                  Re: Sort of trivial code challenge - may be interesting to you anyway Bart <bc@freeuk.com> - 2026-03-04 13:20 +0000
                Re: Sort of trivial code challenge - may be interesting to you anyway DFS <nospam@dfs.com> - 2026-03-04 08:30 -0500
                  Re: Sort of trivial code challenge - may be interesting to you anyway Bart <bc@freeuk.com> - 2026-03-04 14:36 +0000
                    Re: Sort of trivial code challenge - may be interesting to you anyway DFS <nospam@dfs.com> - 2026-03-04 10:02 -0500
                      Re: Sort of trivial code challenge - may be interesting to you anyway Michael S <already5chosen@yahoo.com> - 2026-03-04 19:27 +0200
                        Re: Sort of trivial code challenge - may be interesting to you anyway DFS <nospam@dfs.com> - 2026-03-05 13:49 -0500
                          Re: Sort of trivial code challenge - may be interesting to you anyway Michael S <already5chosen@yahoo.com> - 2026-03-05 21:02 +0200
                          Re: Sort of trivial code challenge - may be interesting to you anyway Bart <bc@freeuk.com> - 2026-03-05 20:39 +0000
                            Re: Sort of trivial code challenge - may be interesting to you anyway DFS <nospam@dfs.com> - 2026-03-05 19:24 -0500
                        Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-05 13:54 -0800
                Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-12 05:50 -0700
                  Re: Sort of trivial code challenge - may be interesting to you anyway Bart <bc@freeuk.com> - 2026-03-13 11:58 +0000
                    Re: Sort of trivial code challenge - may be interesting to you anyway Bart <bc@freeuk.com> - 2026-03-13 23:00 +0000
                      Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-15 15:54 -0700
                        Re: Sort of trivial code challenge - may be interesting to you anyway Bart <bc@freeuk.com> - 2026-03-15 23:42 +0000
                          Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-04-06 12:02 -0700
                    Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-15 15:43 -0700
      Re: Sort of trivial code challenge - may be interesting to you anyway DFS <nospam@dfs.com> - 2026-03-02 17:40 -0500
        Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-02 21:09 -0800
          Re: Sort of trivial code challenge - may be interesting to you anyway DFS <nospam@dfs.com> - 2026-03-03 08:23 -0500
            Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-03 06:20 -0800
              Re: Sort of trivial code challenge - may be interesting to you anyway Michael S <already5chosen@yahoo.com> - 2026-03-03 23:56 +0200
                Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-03 15:51 -0800
                  Re: Sort of trivial code challenge - may be interesting to you anyway Michael S <already5chosen@yahoo.com> - 2026-03-04 11:45 +0200
                    Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-04 07:01 -0800
                Re: Sort of trivial code challenge - may be interesting to you anyway Bonita Montero <Bonita.Montero@gmail.com> - 2026-03-11 11:37 +0100
              Re: Sort of trivial code challenge - may be interesting to you anyway DFS <nospam@dfs.com> - 2026-03-04 08:29 -0500
                Re: Sort of trivial code challenge - may be interesting to you anyway Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2026-03-04 16:02 +0100
                Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-04 08:09 -0800
                  Re: Sort of trivial code challenge - may be interesting to you anyway DFS <nospam@dfs.com> - 2026-03-06 10:34 -0500
                    Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-06 08:46 -0800
                Re: Sort of trivial code challenge - may be interesting to you anyway Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2026-03-04 11:25 -0800
                  Re: Sort of trivial code challenge - may be interesting to you anyway DFS <nospam@dfs.com> - 2026-03-05 13:46 -0500
                    Re: Sort of trivial code challenge - may be interesting to you anyway David Brown <david.brown@hesbynett.no> - 2026-03-05 21:34 +0100
          Re: Sort of trivial code challenge - may be interesting to you anyway Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2026-03-05 19:09 +0000
            Re: Sort of trivial code challenge - may be interesting to you anyway Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2026-03-05 21:12 +0000
              Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-05 14:12 -0800
                Re: Sort of trivial code challenge - may be interesting to you anyway Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2026-03-05 22:24 +0000
                  Re: Sort of trivial code challenge - may be interesting to you anyway Michael S <already5chosen@yahoo.com> - 2026-03-06 01:00 +0200
                    Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-05 15:08 -0800
                  Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-05 15:05 -0800
              Re: Sort of trivial code challenge - may be interesting to you anyway Janis Papanagnou <janis_papanagnou@hotmail.com> - 2026-03-06 00:18 +0100
                Re: Sort of trivial code challenge - may be interesting to you anyway Michael S <already5chosen@yahoo.com> - 2026-03-07 22:04 +0200
                  Re: Sort of trivial code challenge - may be interesting to you anyway Janis Papanagnou <janis_papanagnou@hotmail.com> - 2026-03-08 00:26 +0100
                    Re: Sort of trivial code challenge - may be interesting to you anyway Michael S <already5chosen@yahoo.com> - 2026-03-08 02:45 +0200
                      Re: Sort of trivial code challenge - may be interesting to you anyway Janis Papanagnou <janis_papanagnou@hotmail.com> - 2026-03-08 17:05 +0100
                  Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-11 07:57 -0700
              Re: Sort of trivial code challenge - may be interesting to you anyway Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2026-03-06 00:12 +0000
                Re: Sort of trivial code challenge - may be interesting to you anyway Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2026-03-06 00:14 +0000
                Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-05 20:31 -0800
                  Re: Sort of trivial code challenge - may be interesting to you anyway Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2026-03-06 13:51 +0000
                    Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-06 08:53 -0800
                      Re: Sort of trivial code challenge - may be interesting to you anyway DFS <nospam@dfs.com> - 2026-03-06 19:36 -0500
                        Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-06 18:14 -0800
                    Re: Sort of trivial code challenge - may be interesting to you anyway Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2026-03-07 18:21 +0000
                      Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-07 11:55 -0800
                        Re: Sort of trivial code challenge - may be interesting to you anyway Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2026-03-07 20:10 +0000
                          Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-11 10:44 -0700
                    Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-07 12:02 -0800
                      Re: Sort of trivial code challenge - may be interesting to you anyway Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2026-03-07 20:14 +0000
                        Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-11 10:53 -0700
                      Re: Sort of trivial code challenge - may be interesting to you anyway DFS <nospam@dfs.com> - 2026-03-07 16:58 -0500
                        Re: Sort of trivial code challenge - may be interesting to you anyway Michael S <already5chosen@yahoo.com> - 2026-03-08 00:35 +0200
                          Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-11 08:23 -0700
                        Re: Sort of trivial code challenge - may be interesting to you anyway Janis Papanagnou <janis_papanagnou@hotmail.com> - 2026-03-08 00:40 +0100
                          Re: Sort of trivial code challenge - may be interesting to you anyway DFS <nospam@dfs.com> - 2026-03-08 10:42 -0400
                            Re: Sort of trivial code challenge - may be interesting to you anyway Bart <bc@freeuk.com> - 2026-03-08 15:18 +0000
                              Re: Sort of trivial code challenge - may be interesting to you anyway DFS <nospam@dfs.com> - 2026-03-08 12:21 -0400
                                Re: Sort of trivial code challenge - may be interesting to you anyway Bart <bc@freeuk.com> - 2026-03-08 19:29 +0000
                                  Re: Sort of trivial code challenge - may be interesting to you anyway DFS <nospam@dfs.com> - 2026-03-09 21:20 -0400
                                    Re: Sort of trivial code challenge - may be interesting to you anyway scott@slp53.sl.home (Scott Lurndal) - 2026-03-10 14:43 +0000
                                      Re: Sort of trivial code challenge - may be interesting to you anyway Michael S <already5chosen@yahoo.com> - 2026-03-10 18:08 +0200
                                        Re: Sort of trivial code challenge - may be interesting to you anyway Giovanni <lsodgf0@home.net.it> - 2026-03-10 17:18 +0100
                                        Re: Sort of trivial code challenge - may be interesting to you anyway scott@slp53.sl.home (Scott Lurndal) - 2026-03-10 16:32 +0000
                                      Re: Sort of trivial code challenge - may be interesting to you anyway Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2026-03-10 15:25 -0700
                                        Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-11 07:07 -0700
                                          Re: Sort of trivial code challenge - may be interesting to you anyway Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2026-03-11 13:49 -0700
                                    Re: Sort of trivial code challenge - may be interesting to you anyway Bart <bc@freeuk.com> - 2026-03-10 20:24 +0000
                                      Re: Sort of trivial code challenge - may be interesting to you anyway Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2026-03-10 15:29 -0700
                                        Re: Sort of trivial code challenge - may be interesting to you anyway Bart <bc@freeuk.com> - 2026-03-11 00:29 +0000
                                        Re: Sort of trivial code challenge - may be interesting to you anyway scott@slp53.sl.home (Scott Lurndal) - 2026-03-11 00:33 +0000
                                          Re: Sort of trivial code challenge - may be interesting to you anyway Bart <bc@freeuk.com> - 2026-03-11 11:04 +0000
                                  Re: Sort of trivial code challenge - may be interesting to you anyway antispam@fricas.org (Waldek Hebisch) - 2026-03-10 20:18 +0000
                                    Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-12 05:37 -0700
                              Re: Sort of trivial code challenge - may be interesting to you anyway Janis Papanagnou <janis_papanagnou@hotmail.com> - 2026-03-08 17:57 +0100
                              Re: Sort of trivial code challenge - may be interesting to you anyway Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2026-03-08 13:19 -0700
                                Re: Sort of trivial code challenge - may be interesting to you anyway Bart <bc@freeuk.com> - 2026-03-09 01:12 +0000
                              Re: Sort of trivial code challenge - may be interesting to you anyway scott@slp53.sl.home (Scott Lurndal) - 2026-03-08 21:42 +0000
                                Re: Sort of trivial code challenge - may be interesting to you anyway "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2026-03-08 15:58 -0700
                                  Re: Sort of trivial code challenge - may be interesting to you anyway David Brown <david.brown@hesbynett.no> - 2026-03-09 08:09 +0100
                                    Re: Sort of trivial code challenge - may be interesting to you anyway Janis Papanagnou <janis_papanagnou@hotmail.com> - 2026-03-09 08:53 +0100
                                    Re: Sort of trivial code challenge - may be interesting to you anyway "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2026-03-09 15:25 -0700
                                Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-11 14:40 -0700
                              Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-12 05:55 -0700
                            Re: Sort of trivial code challenge - may be interesting to you anyway Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2026-03-08 16:00 +0000
                              Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-11 12:44 -0700
                            Re: Sort of trivial code challenge - may be interesting to you anyway Janis Papanagnou <janis_papanagnou@hotmail.com> - 2026-03-08 17:36 +0100
                            Re: Sort of trivial code challenge - may be interesting to you anyway Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2026-03-08 13:27 -0700
                            Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-11 06:33 -0700
                        Re: Sort of trivial code challenge - may be interesting to you anyway David Brown <david.brown@hesbynett.no> - 2026-03-08 12:22 +0100
                        Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-11 06:27 -0700
                      Re: Sort of trivial code challenge - may be interesting to you anyway Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2026-03-07 16:43 -0800
                        Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-11 07:29 -0700
                          Re: Sort of trivial code challenge - may be interesting to you anyway Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2026-03-11 14:22 -0700
                            Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-04-25 10:07 -0700
                              Re: Sort of trivial code challenge - may be interesting to you anyway Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2026-04-25 15:54 -0700
                                Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-04-30 03:13 -0700
                Re: Sort of trivial code challenge - may be interesting to you anyway Bart <bc@freeuk.com> - 2026-03-06 16:02 +0000
                  Re: Sort of trivial code challenge - may be interesting to you anyway DFS <nospam@dfs.com> - 2026-03-06 12:11 -0500
                    Re: Sort of trivial code challenge - may be interesting to you anyway DFS <nospam@dfs.com> - 2026-03-06 13:01 -0500
                      Re: Sort of trivial code challenge - may be interesting to you anyway DFS <nospam@dfs.com> - 2026-03-06 13:28 -0500
                    Re: Sort of trivial code challenge - may be interesting to you anyway Bart <bc@freeuk.com> - 2026-03-06 21:53 +0000
                      Re: Sort of trivial code challenge - may be interesting to you anyway DFS <nospam@dfs.com> - 2026-03-06 22:14 -0500
                        Re: Sort of trivial code challenge - may be interesting to you anyway Janis Papanagnou <janis_papanagnou@hotmail.com> - 2026-03-07 07:33 +0100
                          Re: Sort of trivial code challenge - may be interesting to you anyway DFS <nospam@dfs.com> - 2026-03-07 10:24 -0500
                            Re: Sort of trivial code challenge - may be interesting to you anyway Janis Papanagnou <janis_papanagnou@hotmail.com> - 2026-03-07 19:16 +0100
                              Re: Sort of trivial code challenge - may be interesting to you anyway DFS <nospam@dfs.com> - 2026-03-07 14:18 -0500
                                Re: Sort of trivial code challenge - may be interesting to you anyway Janis Papanagnou <janis_papanagnou@hotmail.com> - 2026-03-08 00:47 +0100
                                  Re: Sort of trivial code challenge - may be interesting to you anyway DFS <nospam@dfs.com> - 2026-03-09 22:18 -0400
                                    Re: Sort of trivial code challenge - may be interesting to you anyway Richard Harnden <richard.nospam@gmail.invalid> - 2026-03-10 10:14 +0000
                                    Re: Sort of trivial code challenge - may be interesting to you anyway Richard Harnden <richard.nospam@gmail.invalid> - 2026-03-11 11:40 +0000
                        Re: Sort of trivial code challenge - may be interesting to you anyway Bart <bc@freeuk.com> - 2026-03-07 13:33 +0000
                          Re: Sort of trivial code challenge - may be interesting to you anyway Richard Harnden <richard.nospam@gmail.invalid> - 2026-03-07 14:53 +0000
                            Re: Sort of trivial code challenge - may be interesting to you anyway Bart <bc@freeuk.com> - 2026-03-07 15:44 +0000
                            Re: Sort of trivial code challenge - may be interesting to you anyway Michael S <already5chosen@yahoo.com> - 2026-03-07 19:53 +0200
                          Re: Sort of trivial code challenge - may be interesting to you anyway DFS <nospam@dfs.com> - 2026-03-07 10:22 -0500
                Re: Sort of trivial code challenge - may be interesting to you anyway Bonita Montero <Bonita.Montero@gmail.com> - 2026-03-11 11:40 +0100
                  Re: Sort of trivial code challenge - may be interesting to you anyway DFS <nospam@dfs.com> - 2026-03-11 11:00 -0400
                    Re: Sort of trivial code challenge - may be interesting to you anyway wij <wyniijj5@gmail.com> - 2026-03-12 00:00 +0800
                      Re: Sort of trivial code challenge - may be interesting to you anyway Bonita Montero <Bonita.Montero@gmail.com> - 2026-03-11 18:03 +0100
                        Re: Sort of trivial code challenge - may be interesting to you anyway scott@slp53.sl.home (Scott Lurndal) - 2026-03-11 17:52 +0000
                        Re: Sort of trivial code challenge - may be interesting to you anyway wij <wyniijj5@gmail.com> - 2026-03-12 23:14 +0800
                          Re: Sort of trivial code challenge - may be interesting to you anyway Bonita Montero <Bonita.Montero@gmail.com> - 2026-03-12 16:23 +0100
                          Re: Sort of trivial code challenge - may be interesting to you anyway Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2026-03-12 16:11 -0700
            Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-05 14:04 -0800
          Re: Sort of trivial code challenge - may be interesting to you anyway Bonita Montero <Bonita.Montero@gmail.com> - 2026-03-11 11:36 +0100
        Re: Sort of trivial code challenge - may be interesting to you anyway Bonita Montero <Bonita.Montero@gmail.com> - 2026-03-11 11:35 +0100
      Re: Sort of trivial code challenge - may be interesting to you anyway Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2026-03-03 15:40 +0000
        Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-03 16:23 -0800
          Re: Sort of trivial code challenge - may be interesting to you anyway Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2026-03-04 15:31 +0000
            Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-04 09:38 -0800
    Re: Sort of trivial code challenge - may be interesting to you anyway Bonita Montero <Bonita.Montero@gmail.com> - 2026-03-03 16:39 +0100
      Re: Sort of trivial code challenge - may be interesting to you anyway DFS <nospam@dfs.com> - 2026-03-03 12:00 -0500
        Re: Sort of trivial code challenge - may be interesting to you anyway Bonita Montero <Bonita.Montero@gmail.com> - 2026-03-04 11:44 +0100
          Re: Sort of trivial code challenge - may be interesting to you anyway DFS <nospam@dfs.com> - 2026-03-04 17:44 -0500
            Re: Sort of trivial code challenge - may be interesting to you anyway Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2026-03-04 15:13 -0800
              Re: Sort of trivial code challenge - may be interesting to you anyway DFS <nospam@dfs.com> - 2026-03-04 21:07 -0500
            Re: Sort of trivial code challenge - may be interesting to you anyway scott@slp53.sl.home (Scott Lurndal) - 2026-03-04 23:37 +0000
            Re: Sort of trivial code challenge - may be interesting to you anyway Bonita Montero <Bonita.Montero@gmail.com> - 2026-03-05 07:32 +0100
              Re: Sort of trivial code challenge - may be interesting to you anyway Bonita Montero <Bonita.Montero@gmail.com> - 2026-03-05 08:23 +0100
          Re: Sort of trivial code challenge - may be interesting to you anyway DFS <nospam@dfs.com> - 2026-03-05 02:24 -0500
            Re: Sort of trivial code challenge - may be interesting to you anyway Bonita Montero <Bonita.Montero@gmail.com> - 2026-03-05 08:46 +0100
              Re: Sort of trivial code challenge - may be interesting to you anyway Bonita Montero <Bonita.Montero@gmail.com> - 2026-03-05 09:52 +0100
                Re: Sort of trivial code challenge - may be interesting to you anyway tTh <tth@none.invalid> - 2026-03-05 10:49 +0100
                  Re: Sort of trivial code challenge - may be interesting to you anyway Bonita Montero <Bonita.Montero@gmail.com> - 2026-03-05 11:03 +0100
                  Re: Sort of trivial code challenge - may be interesting to you anyway gazelle@shell.xmission.com (Kenny McCormack) - 2026-03-05 15:22 +0000
              Re: Sort of trivial code challenge - may be interesting to you anyway DFS <nospam@dfs.com> - 2026-03-05 05:06 -0500
                Re: Sort of trivial code challenge - may be interesting to you anyway Bonita Montero <Bonita.Montero@gmail.com> - 2026-03-05 11:13 +0100
                  Re: Sort of trivial code challenge - may be interesting to you anyway DFS <nospam@dfs.com> - 2026-03-05 14:11 -0500
                    Re: Sort of trivial code challenge - may be interesting to you anyway Bonita Montero <Bonita.Montero@gmail.com> - 2026-03-06 03:35 +0100
            Re: Sort of trivial code challenge - may be interesting to you anyway scott@slp53.sl.home (Scott Lurndal) - 2026-03-05 14:49 +0000
              Re: Sort of trivial code challenge - may be interesting to you anyway Janis Papanagnou <janis_papanagnou@hotmail.com> - 2026-03-05 19:27 +0100
              Re: Sort of trivial code challenge - may be interesting to you anyway Bonita Montero <Bonita.Montero@gmail.com> - 2026-03-05 19:46 +0100
                Re: Sort of trivial code challenge - may be interesting to you anyway tTh <tth@none.invalid> - 2026-03-05 20:50 +0100
                  Re: Sort of trivial code challenge - may be interesting to you anyway Michael S <already5chosen@yahoo.com> - 2026-03-05 22:34 +0200
                  Re: Sort of trivial code challenge - may be interesting to you anyway Bonita Montero <Bonita.Montero@gmail.com> - 2026-03-06 07:48 +0100
                    Re: Sort of trivial code challenge - may be interesting to you anyway Michael S <already5chosen@yahoo.com> - 2026-03-06 11:49 +0200
                      Re: Sort of trivial code challenge - may be interesting to you anyway Bonita Montero <Bonita.Montero@gmail.com> - 2026-03-06 13:41 +0100
                        Re: Sort of trivial code challenge - may be interesting to you anyway Michael S <already5chosen@yahoo.com> - 2026-03-06 15:33 +0200
                          Re: Sort of trivial code challenge - may be interesting to you anyway Bonita Montero <Bonita.Montero@gmail.com> - 2026-03-06 14:42 +0100
              Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-05 13:49 -0800
                Re: Sort of trivial code challenge - may be interesting to you anyway scott@slp53.sl.home (Scott Lurndal) - 2026-03-06 02:17 +0000
                  Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-05 20:06 -0800
                    Re: Sort of trivial code challenge - may be interesting to you anyway scott@slp53.sl.home (Scott Lurndal) - 2026-03-06 14:58 +0000
                      Re: Sort of trivial code challenge - may be interesting to you anyway Michael S <already5chosen@yahoo.com> - 2026-03-06 17:13 +0200
                      Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-06 08:37 -0800
      Re: Sort of trivial code challenge - may be interesting to you anyway scott@slp53.sl.home (Scott Lurndal) - 2026-03-03 17:29 +0000
        Re: Sort of trivial code challenge - may be interesting to you anyway Bonita Montero <Bonita.Montero@gmail.com> - 2026-03-03 19:20 +0100
      Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-03 16:26 -0800
        Re: Sort of trivial code challenge - may be interesting to you anyway Bonita Montero <Bonita.Montero@gmail.com> - 2026-03-04 05:27 +0100
    Re: Sort of trivial code challenge - may be interesting to you anyway Opus <ifonly@youknew.org> - 2026-03-04 22:42 +0100
    Re: Sort of trivial code challenge - may be interesting to you anyway peter <peter.noreply@tin.it> - 2026-03-14 10:42 +0100
      Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-15 15:09 -0700
        Re: Sort of trivial code challenge - may be interesting to you anyway Bonita Montero <Bonita.Montero@gmail.com> - 2026-03-16 09:04 +0100

Page 11 of 11 — ← Prev page 1 … 9 10 [11]


#396814

FromMichael S <already5chosen@yahoo.com>
Date2026-03-06 11:49 +0200
Message-ID<20260306114941.00000591@yahoo.com>
In reply to#396813
On Fri, 6 Mar 2026 07:48:05 +0100
Bonita Montero <Bonita.Montero@gmail.com> wrote:

> Am 05.03.2026 um 20:50 schrieb tTh:
> > On 3/5/26 19:46, Bonita Montero wrote:
> >   
> >>> $ printf '%f\n' $(( ceil(log10( 8*8)) ))
> >>> 2.000000
> >>>  
> >>
> >> Don't do that with 64 bit integrals and a FPU which has 53 bits
> >> mantissa.  
> > 
> >     Why ?  
> 
> Because the 53 bits may mistakenly represent a power of ten because
> the lower bits were dropped.
> 

The formula is incorrect, regardless.
With correct formula, i.e. floor(..)+1, imprecision become harmless.
For numbers like 9999999999999979 you get one unnecessary space.
Not a big deal.

[toc] | [prev] | [next] | [standalone]


#396815

FromBonita Montero <Bonita.Montero@gmail.com>
Date2026-03-06 13:41 +0100
Message-ID<10oei1c$lr3s$1@raubtier-asyl.eternal-september.org>
In reply to#396814
Am 06.03.2026 um 10:49 schrieb Michael S:

> The formula is incorrect, regardless.
> With correct formula, i.e. floor(..)+1, imprecision become harmless.
> For numbers like 9999999999999979 you get one unnecessary space.
> Not a big deal.

Then better count characters.

[toc] | [prev] | [next] | [standalone]


#396816

FromMichael S <already5chosen@yahoo.com>
Date2026-03-06 15:33 +0200
Message-ID<20260306153324.00001138@yahoo.com>
In reply to#396815
On Fri, 6 Mar 2026 13:41:22 +0100
Bonita Montero <Bonita.Montero@gmail.com> wrote:

> Am 06.03.2026 um 10:49 schrieb Michael S:
> 
> > The formula is incorrect, regardless.
> > With correct formula, i.e. floor(..)+1, imprecision become harmless.
> > For numbers like 9999999999999979 you get one unnecessary space.
> > Not a big deal.  
> 
> Then better count characters.

There's more than one way to skin a cat.
Ogh, sorry. I mean, more than one to post a picture of kitten.

[toc] | [prev] | [next] | [standalone]


#396817

FromBonita Montero <Bonita.Montero@gmail.com>
Date2026-03-06 14:42 +0100
Message-ID<10oelk0$mpao$1@raubtier-asyl.eternal-september.org>
In reply to#396816
Am 06.03.2026 um 14:33 schrieb Michael S:

> There's more than one way to skin a cat.
> Ogh, sorry. I mean, more than one to post a picture of kitten.

If efficiency doesn't count (log10 is about 20 cycles on my PC)
chose the precise solution, even more if anyone understands that.

[toc] | [prev] | [next] | [standalone]


#396796

FromTim Rentsch <tr.17687@z991.linuxsc.com>
Date2026-03-05 13:49 -0800
Message-ID<86cy1ic5fm.fsf@linuxsc.com>
In reply to#396782
scott@slp53.sl.home (Scott Lurndal) writes:

> DFS <nospam@dfs.com> writes:
>
>> On 3/4/2026 5:44 AM, Bonita Montero wrote:
>>
>>    int colwidth = sprintf(cw,"%d",max) + 1;
>
> using ciel(log10(rows*columns)) performs better than snprintf
> in this application.
>
>
> $ printf '%f\n' $(( ceil(log10( 8*8)) ))
> 2.000000

Using snprintf() is more correct and also more obviously correct.

    #include <stdio.h>
    #include <math.h>

    int
    main(){
        printf( "  cutoff   snprintf   ceil(log)\n" );
        printf( "  ------   --------   -----------\n" );
        for( signed cutoff = 0;  cutoff < 12;  cutoff++  ){
            int a = snprintf( 0, 0, "%d", cutoff );
            int b = ceil(log10(cutoff));
            printf( "  %6d   %8d   %11d\n", cutoff, a, b );
        }
    }

gives

      cutoff   snprintf   ceil(log)
      ------   --------   -----------
           0          1   -2147483648
           1          1             0
           2          1             1
           3          1             1
           4          1             1
           5          1             1
           6          1             1
           7          1             1
           8          1             1
           9          1             1
          10          2             1
          11          2             2

Also the snprintf() way doesn't need -lm.  :)

[toc] | [prev] | [next] | [standalone]


#396808

Fromscott@slp53.sl.home (Scott Lurndal)
Date2026-03-06 02:17 +0000
Message-ID<gPqqR.197267$tm1.78938@fx14.iad>
In reply to#396796
Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
>scott@slp53.sl.home (Scott Lurndal) writes:
>
>> DFS <nospam@dfs.com> writes:
>>
>>> On 3/4/2026 5:44 AM, Bonita Montero wrote:
>>>
>>>    int colwidth = sprintf(cw,"%d",max) + 1;
>>
>> using ciel(log10(rows*columns)) performs better than snprintf
>> in this application.
>>
>>
>> $ printf '%f\n' $(( ceil(log10( 8*8)) ))
>> 2.000000
>
>Using snprintf() is more correct and also more obviously correct.
>

Yes, I had assumed the first row, first column would be zero, not one.

[toc] | [prev] | [next] | [standalone]


#396810

FromTim Rentsch <tr.17687@z991.linuxsc.com>
Date2026-03-05 20:06 -0800
Message-ID<86ms0lbo01.fsf@linuxsc.com>
In reply to#396808
scott@slp53.sl.home (Scott Lurndal) writes:

> Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
>
>> scott@slp53.sl.home (Scott Lurndal) writes:
>>
>>> DFS <nospam@dfs.com> writes:
>>>
>>>> On 3/4/2026 5:44 AM, Bonita Montero wrote:
>>>>
>>>>    int colwidth = sprintf(cw,"%d",max) + 1;
>>>
>>> using ciel(log10(rows*columns)) performs better than snprintf
>>> in this application.
>>>
>>>
>>> $ printf '%f\n' $(( ceil(log10( 8*8)) ))
>>> 2.000000
>>
>> Using snprintf() is more correct and also more obviously correct.
>
> Yes, I had assumed the first row, first column would be zero, not one.

The value for 10 is also wrong.  And 100.  And 1000.  etc...

By the way, I see no reason to disallow a cutoff value of 0.

[toc] | [prev] | [next] | [standalone]


#396819

Fromscott@slp53.sl.home (Scott Lurndal)
Date2026-03-06 14:58 +0000
Message-ID<kYBqR.180688$8Wo8.128957@fx09.iad>
In reply to#396810
Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
>scott@slp53.sl.home (Scott Lurndal) writes:
>
>> Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
>>
>>> scott@slp53.sl.home (Scott Lurndal) writes:
>>>
>>>> DFS <nospam@dfs.com> writes:
>>>>
>>>>> On 3/4/2026 5:44 AM, Bonita Montero wrote:
>>>>>
>>>>>    int colwidth = sprintf(cw,"%d",max) + 1;
>>>>
>>>> using ciel(log10(rows*columns)) performs better than snprintf
>>>> in this application.
>>>>
>>>>
>>>> $ printf '%f\n' $(( ceil(log10( 8*8)) ))
>>>> 2.000000
>>>
>>> Using snprintf() is more correct and also more obviously correct.
>>
>> Yes, I had assumed the first row, first column would be zero, not one.
>
>The value for 10 is also wrong.  And 100.  And 1000.  etc...

No, 10*10 yields 100 values from 0 to 99.

[toc] | [prev] | [next] | [standalone]


#396820

FromMichael S <already5chosen@yahoo.com>
Date2026-03-06 17:13 +0200
Message-ID<20260306171342.00000bdb@yahoo.com>
In reply to#396819
On Fri, 06 Mar 2026 14:58:24 GMT
scott@slp53.sl.home (Scott Lurndal) wrote:

> Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
> >scott@slp53.sl.home (Scott Lurndal) writes:
> >  
> >> Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
> >>  
> >>> scott@slp53.sl.home (Scott Lurndal) writes:
> >>>  
> >>>> DFS <nospam@dfs.com> writes:
> >>>>  
> >>>>> On 3/4/2026 5:44 AM, Bonita Montero wrote:
> >>>>>
> >>>>>    int colwidth = sprintf(cw,"%d",max) + 1;  
> >>>>
> >>>> using ciel(log10(rows*columns)) performs better than snprintf
> >>>> in this application.
> >>>>
> >>>>
> >>>> $ printf '%f\n' $(( ceil(log10( 8*8)) ))
> >>>> 2.000000  
> >>>
> >>> Using snprintf() is more correct and also more obviously correct.
> >>>  
> >>
> >> Yes, I had assumed the first row, first column would be zero, not
> >> one.  
> >
> >The value for 10 is also wrong.  And 100.  And 1000.  etc...  
> 
> No, 10*10 yields 100 values from 0 to 99.

The challenge is to print numbers starting from  1.
Look at the 1st post.
That is, if your newsreader allows it. If it is not then just believe
me.

[toc] | [prev] | [next] | [standalone]


#396825

FromTim Rentsch <tr.17687@z991.linuxsc.com>
Date2026-03-06 08:37 -0800
Message-ID<86eclwc3sg.fsf@linuxsc.com>
In reply to#396819
scott@slp53.sl.home (Scott Lurndal) writes:

> Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
>
>> scott@slp53.sl.home (Scott Lurndal) writes:
>>
>>> Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
>>>
>>>> scott@slp53.sl.home (Scott Lurndal) writes:
>>>>
>>>>> DFS <nospam@dfs.com> writes:
>>>>>
>>>>>> On 3/4/2026 5:44 AM, Bonita Montero wrote:
>>>>>>
>>>>>>    int colwidth = sprintf(cw,"%d",max) + 1;
>>>>>
>>>>> using ciel(log10(rows*columns)) performs better than snprintf
>>>>> in this application.
>>>>>
>>>>>
>>>>> $ printf '%f\n' $(( ceil(log10( 8*8)) ))
>>>>> 2.000000
>>>>
>>>> Using snprintf() is more correct and also more obviously correct.
>>>
>>> Yes, I had assumed the first row, first column would be zero, not one.
>>
>> The value for 10 is also wrong.  And 100.  And 1000.  etc...
>
> No, 10*10 yields 100 values from 0 to 99.

You changed the subject.  We were talking about how to
calculate an appropriate field width given a maximum value.
The problem under discussion produces values from 1 to
maximum value, inclusive.  The expression ceil(log10( max ) )
gives wrong answers when max is a power of 10.  I haven't
looked at Bonita Montero's code but based on the snippet
above it seems clear he is responding to the original problem
statement, even if he may have misunderstood what that was
asking for.

[toc] | [prev] | [next] | [standalone]


#396740

Fromscott@slp53.sl.home (Scott Lurndal)
Date2026-03-03 17:29 +0000
Message-ID<oUEpR.240916$UtT5.114693@fx02.iad>
In reply to#396737
Bonita Montero <Bonita.Montero@gmail.com> writes:
>I think it's better to do that in C++ and not in C:

The only difference is that you're using the
really awful C++ input and output streams.   Horrible stuff.

The C version is far more readable.

[toc] | [prev] | [next] | [standalone]


#396741

FromBonita Montero <Bonita.Montero@gmail.com>
Date2026-03-03 19:20 +0100
Message-ID<10o78p0$296rp$1@raubtier-asyl.eternal-september.org>
In reply to#396740
Am 03.03.2026 um 18:29 schrieb Scott Lurndal:
> Bonita Montero <Bonita.Montero@gmail.com> writes:
>> I think it's better to do that in C++ and not in C:
> 
> The only difference is that you're using the
> really awful C++ input and output streams.   Horrible stuff.
> The C version is far more readable.

That's a matter of opinion. For me C is an awful language.
You need mutiple times the code like in C++.

[toc] | [prev] | [next] | [standalone]


#396747

FromTim Rentsch <tr.17687@z991.linuxsc.com>
Date2026-03-03 16:26 -0800
Message-ID<86tsuwcudo.fsf@linuxsc.com>
In reply to#396737
Bonita Montero <Bonita.Montero@gmail.com> writes:

> I think it's better to do that in C++ and not in C:

Then your response should be posted in comp.lang.c++
and not in comp.lang.c.

[toc] | [prev] | [next] | [standalone]


#396748

FromBonita Montero <Bonita.Montero@gmail.com>
Date2026-03-04 05:27 +0100
Message-ID<10o8cbb$2klrq$1@raubtier-asyl.eternal-september.org>
In reply to#396747
Am 04.03.2026 um 01:26 schrieb Tim Rentsch:
> Bonita Montero <Bonita.Montero@gmail.com> writes:
> 
>> I think it's better to do that in C++ and not in C:
> 
> Then your response should be posted in comp.lang.c++
> and not in comp.lang.c.

Comparisons in both directions fit in either group.

[toc] | [prev] | [next] | [standalone]


#396768

FromOpus <ifonly@youknew.org>
Date2026-03-04 22:42 +0100
Message-ID<10oa90k$39g8i$1@dont-email.me>
In reply to#396684
On 19/02/2026 22:55, DFS wrote:
> Challenge is to output sequential numbers by column then row:
> 
> 1   6  11  16  21
> 2   7  12  17  22
> 3   8  13  18  23
> 4   9  14  19  24
> 5  10  15  20  25
> (...)

A challenge, or homework.

[toc] | [prev] | [next] | [standalone]


#396999

Frompeter <peter.noreply@tin.it>
Date2026-03-14 10:42 +0100
Message-ID<20260314104246.0000613e@tin.it>
In reply to#396684
On Thu, 19 Feb 2026 16:55:25 -0500
DFS <nospam@dfs.com> wrote:

> Challenge is to output sequential numbers by column then row:
> 
> 1   6  11  16  21
> 2   7  12  17  22
> 3   8  13  18  23
> 4   9  14  19  24
> 5  10  15  20  25
> 

> 
> --------------------------------------------------------------------
> 1) must be able to cut the output off at any arbitrary value
>     lower than rows x columns
> --------------------------------------------------------------------

> --------------------------------------------------------------------
> 2) if you don't specify rows and columns, your solution must try
>     to calculate them to form a square (same # of rows and columns)
>     that includes only 1 to N.
> 
>     If rows=columns can't be calculated, return message 'not possible'
> --------------------------------------------------------------------

Here is another version!
This has two alternative implementation techniques:

- It uses a state machine with computed goto instead of loops
- It creates a string in memory and outputs that at the end

computed gotos is a gcc extension (also supported by clang).

Here is the code

BR
Peter

// 
// compile with gcc or clang 
// options -O2 

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

unsigned int R=0;
unsigned int C=0;
unsigned int Cut=0;

// use to calculate number of display digits

unsigned int dwidth(unsigned int n) {
    int i=0;
    while(n) {
        n=n/10;
        i++;
    }
    return(i);
}

// bitwise sqrt from Wikipedia

unsigned int isqrt(unsigned int n) {
    if(n<2)return(n);
    unsigned int small=isqrt(n>>2)<<1;
    unsigned int large=small+1;
    return((large*large>n)?small:large);
}

unsigned int addnr(unsigned int n, char *str, unsigned int pos, unsigned int w) {
    pos=pos+w;
    unsigned int idx=pos;
    do {
        str[--idx]="0123456789"[n%10];
        n = n/10;
        w--;
    } while(n);
    while(w) {
        str[--idx]=' ';
        w--;
    }
    return(pos);
}

void type(char *str, unsigned int n) {
    write(STDOUT_FILENO, str, n);
    }


void parseargs(int argc, char *argv[]) {
    
    switch(argc) {
        
        case 2:     // only Cut
            Cut=atoi(argv[1]);
            R=isqrt(Cut);
            if(R*R<Cut)R++;
            C=R;
            if((R*(R-1)>=Cut)){
                puts("Error could not form square");
                exit(0);}
            break;
        
        case 4:     // Rows Cols Cut
            Cut=atoi(argv[3]);
        
        case 3:     // Rows Cols
            R=atoi(argv[1]);
            C=atoi(argv[2]);
            if(Cut==0)Cut=R*C;
            if(Cut<R)R=Cut;
            if(Cut>0&&R>0&&C>0)break;
            puts("Error input can not be zero or text\n");
        
        default:
            puts("Usage:");
            fputs(argv[0], stdout); puts(" #rows #cols cutout");
            fputs(argv[0], stdout); puts(" #rows #cols");
            fputs(argv[0], stdout); puts(" cutout");
            exit(0);
        }
}


void SM(unsigned int rows, unsigned int cols, unsigned int cut ) {

const static void* jmp_table[2][2] = {	
	{&&print, &&out,},
	{&&newline,	&&out,},
    };
    
	unsigned int N=rows*cols;
    unsigned int col=0;
    unsigned int row=0;
    unsigned int nr=1;
    unsigned int w=dwidth(cut)+2;
    unsigned int pos=0;
    char *str=malloc(cut*w+rows*2+16);
 
    // start of the state machine

    newline: 			// emit a newline
                        // then fall tru to print
        str[pos++]=10;
        col=0;
        row++;

    print: 			    //  print out number
        nr=col*rows+row;
        pos = nr<=cut ? addnr(nr, str, pos, w) : pos ;
        col++;
        goto *jmp_table[col==cols][nr==N];

	out: 			    //  exit the SM
	str[pos++]=10;
        type(str, pos);
        return;
	
} //SM

int main(int argc, char *argv[]){

    parseargs(argc, argv);
    
    SM(R, C, Cut);
    
    return(0);
    
}

[toc] | [prev] | [next] | [standalone]


#397008

FromTim Rentsch <tr.17687@z991.linuxsc.com>
Date2026-03-15 15:09 -0700
Message-ID<86pl5468yx.fsf@linuxsc.com>
In reply to#396999
peter <peter.noreply@tin.it> writes:

[some white space added]

> On Thu, 19 Feb 2026 16:55:25 -0500
> DFS <nospam@dfs.com> wrote:
>
>> Challenge is to output sequential numbers by column then row:
>>
>> 1   6  11  16  21
>> 2   7  12  17  22
>> 3   8  13  18  23
>> 4   9  14  19  24
>> 5  10  15  20  25
>>
>> --------------------------------------------------------------------
>> 1) must be able to cut the output off at any arbitrary value
>>     lower than rows x columns
>> --------------------------------------------------------------------
>>
>> --------------------------------------------------------------------
>> 2) if you don't specify rows and columns, your solution must try
>>     to calculate them to form a square (same # of rows and columns)
>>     that includes only 1 to N.
>>
>>     If rows=columns can't be calculated, return message 'not possible'
>> --------------------------------------------------------------------
>
> Here is another version!
> This has two alternative implementation techniques:
>
> - It uses a state machine with computed goto instead of loops

Commentary on that below

> - It creates a string in memory and outputs that at the end

The code outputs values in the same order as they would be
if printf() were used.  Given the existence of a buffer, it
seems like it would be easier to add the output values in
simple ascending value order.  To say that another way, it
doesn't look like building the string in memory, the way it
is done here, buys anything.

> computed gotos is a gcc extension (also supported by clang).
>
> Here is the code

[...]

> void SM(unsigned int rows, unsigned int cols, unsigned int cut ) {
>
> const static void* jmp_table[2][2] = {
>     {&&print, &&out,},
>     {&&newline, &&out,},
>     };
>
>     unsigned int N=rows*cols;
>     unsigned int col=0;
>     unsigned int row=0;
>     unsigned int nr=1;
>     unsigned int w=dwidth(cut)+2;
>     unsigned int pos=0;
>     char *str=malloc(cut*w+rows*2+16);
>
>     // start of the state machine
>
>     newline:  // emit a newline
>               // then fall tru to print
>         str[pos++]=10;
>         col=0;
>         row++;
>
>     print:    //  print out number
>         nr=col*rows+row;
>         pos = nr<=cut ? addnr(nr, str, pos, w) : pos ;
>         col++;
>         goto *jmp_table[col==cols][nr==N];
>
>     out:      //  exit the SM
>     str[pos++]=10;
>         type(str, pos);
>         return;
>
> } //SM

This function is a lot more complicated than it needs to be.  The
code below uses stdio rather than in-memory string buffering, but
it would be easy to change that if desired.

    void
    show_board( unsigned height, unsigned width, unsigned cutoff ){
      const  int       D =  digits_width( cutoff );
      const  unsigned  R =  cutoff < height ? cutoff : height;
        unsigned   r = 0,   c = 0;

        while(  r < R  ){
            unsigned v = r + c*height;
            if(  v < cutoff    )  printf( " %*u", D, v+1 );
            if(  ++c >= width  )  putchar( '\n' ),  c = 0,  r++;
        }
    }

[toc] | [prev] | [next] | [standalone]


#397012

FromBonita Montero <Bonita.Montero@gmail.com>
Date2026-03-16 09:04 +0100
Message-ID<10p8die$1q6mm$1@raubtier-asyl.eternal-september.org>
In reply to#397008
Am 15.03.2026 um 23:09 schrieb Tim Rentsch:

> This function is a lot more complicated than it needs to be. ...

You wanted to say: Better use C++ !

;-)

[toc] | [prev] | [standalone]


Page 11 of 11 — ← Prev page 1 … 9 10 [11]

Back to top | Article view | comp.lang.c


csiph-web