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


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

my solution for Pascal strings

Started byDexterr <dejangru@gmail.com>
First post2014-12-22 06:08 -0800
Last post2015-03-31 09:12 +0200
Articles 20 on this page of 208 — 29 participants

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


Contents

  my solution for Pascal strings Dexterr <dejangru@gmail.com> - 2014-12-22 06:08 -0800
    Re: my solution for Pascal strings BartC <bc@freeuk.com> - 2014-12-22 14:21 +0000
      Re: my solution for Pascal strings Dexterr <dejangru@gmail.com> - 2014-12-22 06:55 -0800
        Re: my solution for Pascal strings Malcolm McLean <malcolm.mclean5@btinternet.com> - 2014-12-22 07:36 -0800
          Re: my solution for Pascal strings Dexterr <dejangru@gmail.com> - 2014-12-22 07:43 -0800
          Re: my solution for Pascal strings Richard Heathfield <invalid@see.sig.invalid> - 2014-12-22 15:49 +0000
            Re: my solution for Pascal strings Dexterr <dejangru@gmail.com> - 2014-12-22 08:01 -0800
              Re: my solution for Pascal strings Richard Heathfield <invalid@see.sig.invalid> - 2014-12-22 16:34 +0000
                Re: my solution for Pascal strings Dexterr <dejangru@gmail.com> - 2014-12-22 08:46 -0800
                  Re: my solution for Pascal strings Johannes Bauer <dfnsonfsduifb@gmx.de> - 2014-12-25 15:36 +0100
                    Re: my solution for Pascal strings Dexterr <dejangru@gmail.com> - 2014-12-25 13:14 -0800
            Re: my solution for Pascal strings Malcolm McLean <malcolm.mclean5@btinternet.com> - 2014-12-22 09:24 -0800
        Re: my solution for Pascal strings BartC <bc@freeuk.com> - 2014-12-22 17:49 +0000
          Re: my solution for Pascal strings Dexterr <dejangru@gmail.com> - 2014-12-22 10:55 -0800
            Re: my solution for Pascal strings BartC <bc@freeuk.com> - 2014-12-22 19:33 +0000
            Re: my solution for Pascal strings Richard Heathfield <invalid@see.sig.invalid> - 2014-12-22 19:41 +0000
              Re: my solution for Pascal strings BartC <bc@freeuk.com> - 2014-12-22 22:35 +0000
                Re: my solution for Pascal strings Richard Heathfield <invalid@see.sig.invalid> - 2014-12-22 22:41 +0000
                Re: my solution for Pascal strings Malcolm McLean <malcolm.mclean5@btinternet.com> - 2014-12-22 16:16 -0800
                  Re: my solution for Pascal strings Ian Collins <ian-news@hotmail.com> - 2014-12-23 13:18 +1300
                    Re: my solution for Pascal strings BartC <bc@freeuk.com> - 2014-12-23 01:33 +0000
                      Re: my solution for Pascal strings Ian Collins <ian-news@hotmail.com> - 2014-12-23 14:41 +1300
                        Re: my solution for Pascal strings Ben Bacarisse <ben.usenet@bsb.me.uk> - 2014-12-23 10:07 +0000
                        Re: my solution for Pascal strings Malcolm McLean <malcolm.mclean5@btinternet.com> - 2014-12-23 02:36 -0800
                          Re: my solution for Pascal strings Keith Thompson <kst-u@mib.org> - 2014-12-23 07:44 -0800
                          Re: my solution for Pascal strings Ian Collins <ian-news@hotmail.com> - 2014-12-24 09:00 +1300
                        Re: my solution for Pascal strings BartC <bc@freeuk.com> - 2014-12-23 10:42 +0000
                          Re: my solution for Pascal strings Ian Collins <ian-news@hotmail.com> - 2014-12-24 08:50 +1300
                            Re: my solution for Pascal strings Richard Heathfield <invalid@see.sig.invalid> - 2014-12-23 20:02 +0000
                              Re: my solution for Pascal strings "Chris M. Thomasson" <no@spam.invalid> - 2014-12-23 12:30 -0800
                            Re: my solution for Pascal strings BartC <bc@freeuk.com> - 2014-12-23 21:12 +0000
                              Re: my solution for Pascal strings Ian Collins <ian-news@hotmail.com> - 2014-12-24 10:50 +1300
                                Re: my solution for Pascal strings Malcolm McLean <malcolm.mclean5@btinternet.com> - 2014-12-23 14:06 -0800
                          Re: my solution for Pascal strings Kaz Kylheku <kaz@kylheku.com> - 2014-12-23 22:22 +0000
                            Re: my solution for Pascal strings BartC <bc@freeuk.com> - 2014-12-24 00:10 +0000
                              Re: my solution for Pascal strings Ian Collins <ian-news@hotmail.com> - 2014-12-24 14:21 +1300
                                Re: my solution for Pascal strings BartC <bc@freeuk.com> - 2014-12-24 11:19 +0000
                                  Re: my solution for Pascal strings Malcolm McLean <malcolm.mclean5@btinternet.com> - 2014-12-24 04:55 -0800
                                    Re: my solution for Pascal strings Ian Collins <ian-news@hotmail.com> - 2014-12-25 08:28 +1300
                                      Re: my solution for Pascal strings Malcolm McLean <malcolm.mclean5@btinternet.com> - 2014-12-24 12:27 -0800
                                        Re: my solution for Pascal strings Keith Thompson <kst-u@mib.org> - 2014-12-24 12:48 -0800
                                        Re: my solution for Pascal strings Ian Collins <ian-news@hotmail.com> - 2014-12-25 10:29 +1300
                                          Re: my solution for Pascal strings Malcolm McLean <malcolm.mclean5@btinternet.com> - 2014-12-24 14:59 -0800
                                    Re: my solution for Pascal strings Les Cargill <lcargill99@comcast.com> - 2014-12-24 13:32 -0600
                                    Re: my solution for Pascal strings Tim Rentsch <txr@alumni.caltech.edu> - 2015-03-24 09:16 -0700
                                      Re: my solution for Pascal strings Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-03-24 09:22 -0700
                                        Re: my solution for Pascal strings Tim Rentsch <txr@alumni.caltech.edu> - 2015-03-25 13:57 -0700
                                      Re: my solution for Pascal strings Keith Thompson <kst-u@mib.org> - 2015-03-24 12:42 -0700
                                        Re: my solution for Pascal strings glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-03-24 20:02 +0000
                                          Re: my solution for Pascal strings Keith Thompson <kst-u@mib.org> - 2015-03-24 13:59 -0700
                                            Re: my solution for Pascal strings glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-03-24 21:56 +0000
                                              Re: my solution for Pascal strings Keith Thompson <kst-u@mib.org> - 2015-03-24 16:02 -0700
                                                Re: my solution for Pascal strings Robert Wessel <robertwessel2@yahoo.com> - 2015-03-25 01:51 -0500
                                            Re: my solution for Pascal strings Tim Rentsch <txr@alumni.caltech.edu> - 2015-03-25 13:50 -0700
                                              Re: my solution for Pascal strings Keith Thompson <kst-u@mib.org> - 2015-03-25 14:53 -0700
                                        Re: my solution for Pascal strings Tim Rentsch <txr@alumni.caltech.edu> - 2015-03-25 13:43 -0700
                                          Re: my solution for Pascal strings Keith Thompson <kst-u@mib.org> - 2015-03-25 15:32 -0700
                                        Re: my solution for Pascal strings Phil Carmody <pc+usenet@asdf.org> - 2015-04-09 02:05 +0300
                                      Re: my solution for Pascal strings fir <profesor.fir@gmail.com> - 2015-03-25 15:43 -0700
                                        Re: my solution for Pascal strings Les Cargill <lcargill99@comcast.com> - 2015-03-25 20:46 -0500
                                          Re: my solution for Pascal strings fir <profesor.fir@gmail.com> - 2015-03-25 23:33 -0700
                                            Re: my solution for Pascal strings Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-03-26 03:02 -0700
                                              Re: my solution for Pascal strings Les Cargill <lcargill99@comcast.com> - 2015-03-26 23:34 -0500
                                                Re: my solution for Pascal strings Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-03-27 12:38 -0700
                                                  Re: my solution for Pascal strings Ian Collins <ian-news@hotmail.com> - 2015-03-28 12:02 +1300
                                                  Re: my solution for Pascal strings Keith Thompson <kst-u@mib.org> - 2015-03-27 16:39 -0700
                                                    Re: my solution for Pascal strings Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-03-27 17:18 -0700
                                                      Re: my solution for Pascal strings Ian Collins <ian-news@hotmail.com> - 2015-03-28 13:34 +1300
                                                      Re: my solution for Pascal strings Richard Damon <Richard@Damon-Family.org> - 2015-03-27 22:09 -0400
                                                        Re: my solution for Pascal strings Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-03-28 05:41 -0700
                                                          Re: my solution for Pascal strings raltbos@xs4all.nl (Richard Bos) - 2015-03-29 15:24 +0000
                                            Re: my solution for Pascal strings Bartc <bc@freeuk.com> - 2015-03-26 10:37 +0000
                                              Re: my solution for Pascal strings fir <profesor.fir@gmail.com> - 2015-03-26 05:56 -0700
                                                Re: my solution for Pascal strings fir <profesor.fir@gmail.com> - 2015-03-26 06:23 -0700
                                                  Re: my solution for Pascal strings asetofsymbols@gmail.com - 2015-03-26 10:07 -0700
                                                    Re: my solution for Pascal strings asetofsymbols@gmail.com - 2015-03-26 10:16 -0700
                                                Re: my solution for Pascal strings fir <profesor.fir@gmail.com> - 2015-03-26 06:30 -0700
                                              Re: my solution for Pascal strings Keith Thompson <kst-u@mib.org> - 2015-03-26 08:39 -0700
                                                Re: my solution for Pascal strings Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-03-26 09:26 -0700
                                                  Re: my solution for Pascal strings Keith Thompson <kst-u@mib.org> - 2015-03-26 10:53 -0700
                                                Re: my solution for Pascal strings Bartc <bc@freeuk.com> - 2015-03-26 18:19 +0000
                                                  Re: my solution for Pascal strings Keith Thompson <kst-u@mib.org> - 2015-03-26 11:33 -0700
                                                    Re: my solution for Pascal strings Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-03-26 12:08 -0700
                                                      Re: my solution for Pascal strings fir <profesor.fir@gmail.com> - 2015-03-26 12:24 -0700
                                                        Re: my solution for Pascal strings Les Cargill <lcargill99@comcast.com> - 2015-03-26 23:46 -0500
                                                  Re: my solution for Pascal strings Les Cargill <lcargill99@comcast.com> - 2015-03-26 23:44 -0500
                                                  Re: my solution for Pascal strings Kaz Kylheku <kaz@kylheku.com> - 2015-03-27 04:53 +0000
                                              Re: my solution for Pascal strings Les Cargill <lcargill99@comcast.com> - 2015-03-26 23:42 -0500
                                                Re: my solution for Pascal strings Richard Heathfield <rjh@cpax.org.uk> - 2015-03-27 07:04 +0000
                                                  Re: my solution for Pascal strings Bartc <bc@freeuk.com> - 2015-03-27 10:43 +0000
                                                    Re: my solution for Pascal strings Richard Heathfield <rjh@cpax.org.uk> - 2015-03-27 10:50 +0000
                                                      Re: my solution for Pascal strings Keith Thompson <kst-u@mib.org> - 2015-03-27 08:23 -0700
                                                      Re: my solution for Pascal strings Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-03-27 12:54 -0700
                                                  Re: my solution for Pascal strings Les Cargill <lcargill99@comcast.com> - 2015-03-28 16:20 -0500
                                                    Re: my solution for Pascal strings Melzzzzz <mel@zzzzz.com> - 2015-03-28 22:23 +0100
                                                      Re: my solution for Pascal strings Ian Collins <ian-news@hotmail.com> - 2015-03-29 10:28 +1300
                                                        Re: my solution for Pascal strings Melzzzzz <mel@zzzzz.com> - 2015-03-28 22:29 +0100
                                                          Re: my solution for Pascal strings Ian Collins <ian-news@hotmail.com> - 2015-03-29 10:35 +1300
                                                            Re: my solution for Pascal strings Melzzzzz <mel@zzzzz.com> - 2015-03-28 22:44 +0100
                                                              Re: my solution for Pascal strings Ian Collins <ian-news@hotmail.com> - 2015-03-29 10:57 +1300
                                                        Re: my solution for Pascal strings Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-03-28 15:09 -0700
                                                    Re: my solution for Pascal strings Richard Heathfield <rjh@cpax.org.uk> - 2015-03-28 21:46 +0000
                                                      Re: my solution for Pascal strings Les Cargill <lcargill99@comcast.com> - 2015-03-29 09:54 -0500
                                                        Re: my solution for Pascal strings Richard Heathfield <rjh@cpax.org.uk> - 2015-03-29 15:54 +0100
                                                          Re: my solution for Pascal strings Les Cargill <lcargill99@comcast.com> - 2015-03-29 19:04 -0500
                                                            Re: my solution for Pascal strings Richard Heathfield <rjh@cpax.org.uk> - 2015-03-30 08:00 +0100
                                                              Re: my solution for Pascal strings Les Cargill <lcargill99@comcast.com> - 2015-03-30 07:58 -0500
                                                                Re: my solution for Pascal strings Richard Heathfield <rjh@cpax.org.uk> - 2015-03-30 14:29 +0100
                                                        Re: my solution for Pascal strings Tim Rentsch <txr@alumni.caltech.edu> - 2015-03-30 07:35 -0700
                                                Re: my solution for Pascal strings Bartc <bc@freeuk.com> - 2015-03-27 16:14 +0000
                                                  Re: my solution for Pascal strings Keith Thompson <kst-u@mib.org> - 2015-03-27 12:15 -0700
                                                    Re: my solution for Pascal strings Ian Collins <ian-news@hotmail.com> - 2015-03-28 08:30 +1300
                                                      Re: my solution for Pascal strings Tim Rentsch <txr@alumni.caltech.edu> - 2015-03-28 14:56 -0700
                                                        Re: my solution for Pascal strings Ian Collins <ian-news@hotmail.com> - 2015-03-29 11:10 +1300
                                                          Re: my solution for Pascal strings Keith Thompson <kst-u@mib.org> - 2015-03-28 20:04 -0700
                                                            Re: my solution for Pascal strings Ian Collins <ian-news@hotmail.com> - 2015-03-29 17:14 +1300
                                                          Re: my solution for Pascal strings Tim Rentsch <txr@alumni.caltech.edu> - 2015-03-30 13:03 -0700
                                                            Re: my solution for Pascal strings Ian Collins <ian-news@hotmail.com> - 2015-03-31 16:40 +1300
                                            Re: my solution for Pascal strings Les Cargill <lcargill99@comcast.com> - 2015-03-26 23:31 -0500
                                              Re: my solution for Pascal strings Keith Thompson <kst-u@mib.org> - 2015-03-26 23:42 -0700
                                                Re: my solution for Pascal strings Les Cargill <lcargill99@comcast.com> - 2015-03-29 19:00 -0500
                                                  Re: my solution for Pascal strings Keith Thompson <kst-u@mib.org> - 2015-03-30 08:15 -0700
                                                    Re: my solution for Pascal strings Les Cargill <lcargill99@comcast.com> - 2015-03-30 18:23 -0500
                                                  Re: my solution for Pascal strings James Kuyper <jameskuyper@verizon.net> - 2015-03-30 12:26 -0400
                                                    Re: my solution for Pascal strings fir <profesor.fir@gmail.com> - 2015-03-30 09:42 -0700
                                                      Re: my solution for Pascal strings Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-03-30 10:28 -0700
                                                        Re: my solution for Pascal strings fir <profesor.fir@gmail.com> - 2015-03-30 10:50 -0700
                                                          Re: my solution for Pascal strings fir <profesor.fir@gmail.com> - 2015-03-30 12:09 -0700
                                                            Re: my solution for Pascal strings fir <profesor.fir@gmail.com> - 2015-03-30 12:21 -0700
                                                        Re: my solution for Pascal strings Bartc <bc@freeuk.com> - 2015-03-30 19:37 +0100
                                                          Re: my solution for Pascal strings Keith Thompson <kst-u@mib.org> - 2015-03-30 12:20 -0700
                                                            Re: my solution for Pascal strings Bartc <bc@freeuk.com> - 2015-03-30 20:49 +0100
                                                              Re: my solution for Pascal strings Keith Thompson <kst-u@mib.org> - 2015-03-30 13:20 -0700
                                                                Re: my solution for Pascal strings Bartc <bc@freeuk.com> - 2015-03-30 21:32 +0100
                                                                  Re: my solution for Pascal strings Keith Thompson <kst-u@mib.org> - 2015-03-30 14:07 -0700
                                                            Re: my solution for Pascal strings Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-03-30 12:55 -0700
                                                              Re: my solution for Pascal strings Bartc <bc@freeuk.com> - 2015-03-30 21:27 +0100
                                              Re: my solution for Pascal strings fir <profesor.fir@gmail.com> - 2015-03-26 23:47 -0700
                                              Re: my solution for Pascal strings Richard Heathfield <rjh@cpax.org.uk> - 2015-03-27 07:11 +0000
                                                Re: my solution for Pascal strings Les Cargill <lcargill99@comcast.com> - 2015-03-29 19:01 -0500
                                                  Re: my solution for Pascal strings Richard Heathfield <rjh@cpax.org.uk> - 2015-03-30 07:57 +0100
                                                    Re: my solution for Pascal strings Les Cargill <lcargill99@comcast.com> - 2015-03-30 18:32 -0500
                                                      Re: my solution for Pascal strings James Kuyper <jameskuyper@verizon.net> - 2015-03-30 19:59 -0400
                                                        Re: my solution for Pascal strings Les Cargill <lcargill99@comcast.com> - 2015-03-30 19:22 -0500
                                                  Re: my solution for Pascal strings Kaz Kylheku <kaz@kylheku.com> - 2015-03-30 23:53 +0000
                                                    Re: my solution for Pascal strings Les Cargill <lcargill99@comcast.com> - 2015-03-30 19:25 -0500
                                                      Re: my solution for Pascal strings Kaz Kylheku <kaz@kylheku.com> - 2015-03-31 01:12 +0000
                                                      Re: my solution for Pascal strings Richard Heathfield <rjh@cpax.org.uk> - 2015-03-31 07:04 +0100
                                                        Re: my solution for Pascal strings Robert Wessel <robertwessel2@yahoo.com> - 2015-03-31 01:24 -0500
                                                          Re: my solution for Pascal strings Richard Heathfield <rjh@cpax.org.uk> - 2015-03-31 07:46 +0100
                                  Re: my solution for Pascal strings Les Cargill <lcargill99@comcast.com> - 2014-12-24 13:18 -0600
                                  Re: my solution for Pascal strings Ian Collins <ian-news@hotmail.com> - 2014-12-25 08:19 +1300
                                    Re: my solution for Pascal strings BartC <bc@freeuk.com> - 2014-12-24 20:05 +0000
                                      Re: my solution for Pascal strings Keith Thompson <kst-u@mib.org> - 2014-12-24 12:18 -0800
                                        Re: my solution for Pascal strings BartC <bc@freeuk.com> - 2014-12-24 20:39 +0000
                                          Re: my solution for Pascal strings Keith Thompson <kst-u@mib.org> - 2014-12-24 12:57 -0800
                                            Re: my solution for Pascal strings BartC <bc@freeuk.com> - 2014-12-24 21:22 +0000
                                              Re: my solution for Pascal strings Keith Thompson <kst-u@mib.org> - 2014-12-24 14:53 -0800
                                                Re: my solution for Pascal strings BartC <bc@freeuk.com> - 2014-12-24 23:46 +0000
                                                Re: my solution for Pascal strings Phil Carmody <pc+usenet@asdf.org> - 2015-01-03 01:48 +0200
                                        Re: my solution for Pascal strings Phil Carmody <pc+usenet@asdf.org> - 2015-01-03 01:43 +0200
                                  Re: my solution for Pascal strings Keith Thompson <kst-u@mib.org> - 2014-12-24 12:05 -0800
                                    Re: my solution for Pascal strings Richard Heathfield <invalid@see.sig.invalid> - 2014-12-24 20:20 +0000
                                      Re: my solution for Pascal strings Keith Thompson <kst-u@mib.org> - 2014-12-24 12:34 -0800
                                    Re: my solution for Pascal strings Malcolm McLean <malcolm.mclean5@btinternet.com> - 2014-12-24 12:37 -0800
                                      Re: my solution for Pascal strings Ian Collins <ian-news@hotmail.com> - 2014-12-25 10:15 +1300
                                        Re: my solution for Pascal strings Malcolm McLean <malcolm.mclean5@btinternet.com> - 2014-12-24 13:43 -0800
                                          Re: my solution for Pascal strings Ian Collins <ian-news@hotmail.com> - 2014-12-25 10:52 +1300
                                            Re: my solution for Pascal strings Malcolm McLean <malcolm.mclean5@btinternet.com> - 2014-12-24 15:02 -0800
                                              Re: my solution for Pascal strings Ian Collins <ian-news@hotmail.com> - 2014-12-25 16:51 +1300
                                                Re: my solution for Pascal strings Keith Thompson <kst-u@mib.org> - 2014-12-24 21:28 -0800
                                                  Re: my solution for Pascal strings fir <profesor.fir@gmail.com> - 2014-12-25 02:21 -0800
                                                    Re: my solution for Pascal strings fir <profesor.fir@gmail.com> - 2014-12-25 02:39 -0800
                                                      Re: my solution for Pascal strings fir <profesor.fir@gmail.com> - 2014-12-25 02:52 -0800
                                                        Re: my solution for Pascal strings fir <profesor.fir@gmail.com> - 2014-12-25 03:09 -0800
                                                          Re: my solution for Pascal strings Richard Damon <Richard@Damon-Family.org> - 2014-12-25 09:32 -0500
                                                            Re: my solution for Pascal strings fir <profesor.fir@gmail.com> - 2014-12-25 06:50 -0800
                                                              Re: my solution for Pascal strings fir <profesor.fir@gmail.com> - 2014-12-25 11:59 -0800
                                                        Re: my solution for Pascal strings fir <profesor.fir@gmail.com> - 2014-12-25 11:38 -0800
                                                          Re: my solution for Pascal strings fir <profesor.fir@gmail.com> - 2014-12-25 11:55 -0800
                                                      Re: my solution for Pascal strings fir <profesor.fir@gmail.com> - 2014-12-25 03:33 -0800
                                                    Re: my solution for Pascal strings fir <profesor.fir@gmail.com> - 2014-12-25 02:56 -0800
                                    Re: my solution for Pascal strings David Thompson <dave.thompson2@verizon.net> - 2015-01-12 15:33 -0500
                  Re: my solution for Pascal strings Kaz Kylheku <kaz@kylheku.com> - 2014-12-23 05:17 +0000
                  Re: my solution for Pascal strings Keith Thompson <kst-u@mib.org> - 2014-12-23 07:43 -0800
                  Re: my solution for Pascal strings raltbos@xs4all.nl (Richard Bos) - 2014-12-23 20:42 +0000
              Re: my solution for Pascal strings Ian Collins <ian-news@hotmail.com> - 2014-12-23 11:48 +1300
                Re: my solution for Pascal strings Richard Heathfield <invalid@see.sig.invalid> - 2014-12-22 23:55 +0000
                  Re: my solution for Pascal strings Ian Collins <ian-news@hotmail.com> - 2014-12-23 13:21 +1300
              Re: my solution for Pascal strings Ian Collins <ian-news@hotmail.com> - 2014-12-23 11:55 +1300
                Re: my solution for Pascal strings Ian Collins <ian-news@hotmail.com> - 2014-12-23 12:12 +1300
                  Re: my solution for Pascal strings Ben Bacarisse <ben.usenet@bsb.me.uk> - 2014-12-22 23:33 +0000
                    Re: my solution for Pascal strings Ian Collins <ian-news@hotmail.com> - 2014-12-23 12:59 +1300
              Re: my solution for Pascal strings BartC <bc@freeuk.com> - 2014-12-22 23:03 +0000
              Re: my solution for Pascal strings CHIN Dihedral <dihedral88888@gmail.com> - 2015-03-26 04:04 -0700
                Re: my solution for Pascal strings Richard Heathfield <rjh@cpax.org.uk> - 2015-03-26 11:22 +0000
      Re: my solution for Pascal strings dmaxime66@gmail.com - 2014-12-28 09:37 -0800
        Re: my solution for Pascal strings BartC <bc@freeuk.com> - 2014-12-28 18:17 +0000
          Re: my solution for Pascal strings dmaxime66@gmail.com - 2014-12-30 05:28 -0800
            Re: my solution for Pascal strings Ian Collins <ian-news@hotmail.com> - 2014-12-31 08:29 +1300
              Re: my solution for Pascal strings glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2014-12-30 23:56 +0000
        Re: my solution for Pascal strings Ian Collins <ian-news@hotmail.com> - 2014-12-29 07:59 +1300
          Re: my solution for Pascal strings Max <dmaxime66@gmail.com> - 2014-12-30 05:24 -0800
            Re: my solution for Pascal strings James Kuyper <jameskuyper@verizon.net> - 2014-12-30 11:29 -0500
              Re: my solution for Pascal strings Max <dmaxime66@gmail.com> - 2014-12-30 10:23 -0800
                Re: my solution for Pascal strings James Kuyper <jameskuyper@verizon.net> - 2014-12-30 14:22 -0500
    Re: my solution for Pascal strings "D. Aaron Sawyer" <aaron@110.net> - 2014-12-22 12:32 -0400
    Re: my solution for Pascal strings "Skybuck Flying" <skybuck2000@hotmail.com> - 2015-03-31 09:12 +0200

Page 1 of 11  [1] 2 3 … 11  Next page →


#55280 — my solution for Pascal strings

FromDexterr <dejangru@gmail.com>
Date2014-12-22 06:08 -0800
Subjectmy solution for Pascal strings
Message-ID<52a5b8b7-8c35-4a96-a438-bf173a427e95@googlegroups.com>
Hi there,

I am a man how is learning a C Programming. I need a help deadly but I don't give a dam how older you are and how smart you are. I am in a very bad position and appriciate very much when somenone want to help and thats all. This crap "you manners are for a sluts of Belgrade", "you should read this if you didn't because you are stupid and inferior then such a perfect software developer as I am", "do your homework for yourself", "you just need a better mark", or "this examples are not from a real life" ... etc, I don't need such a crap. If you want to give me such advices please ignore me. I will help everyone if I know an answer without judges you are person such as.... 

I just need to learn a C Programming. I love it. I like it. I enjoy C and I am a courious.

This is my fucking solution for converting C strings in Pascal strings.

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

typedef struct PascalString {
  int size;
  char *string;
} PString;

struct PascalString *newPascalString(char *stringC) {  
  int i;  
  PString *pascal_string = malloc(sizeof(struct PascalString));  
  pascal_string->size = 11;
  pascal_string->string = malloc(sizeof(char) * pascal_string->size);

  for(i = 0; i < pascal_string->size; i++) {
    pascal_string[i]->string = stringC[i];  // here is my problem
  }  
  return pascal_string;
}

int main()
{ 
  char *c_string = "Mississippi";
  newPascalString(c_string);  
  return 0;
}

[toc] | [next] | [standalone]


#55281

FromBartC <bc@freeuk.com>
Date2014-12-22 14:21 +0000
Message-ID<9OVlw.186008$812.147958@fx20.am4>
In reply to#55280
On 22/12/2014 14:08, Dexterr wrote:

> This is my ... solution for converting C strings in Pascal strings.
>
> #include <stdio.h>
> #include <stdlib.h>
>
> typedef struct PascalString {
>    int size;
>    char *string;
> } PString;
>
> struct PascalString *newPascalString(char *stringC) {
>    int i;
>    PString *pascal_string = malloc(sizeof(struct PascalString));
>    pascal_string->size = 11;
>    pascal_string->string = malloc(sizeof(char) * pascal_string->size);
>
>    for(i = 0; i < pascal_string->size; i++) {
>      pascal_string[i]->string = stringC[i];  // here is my problem
>    }
>    return pascal_string;
> }
>
> int main()
> {
>    char *c_string = "Mississippi";
>    newPascalString(c_string);
>    return 0;
> }

Your approach seems wrong. I revised your code to end up with the 
following, which seems to work, although I haven't had time to test it 
fully. It should be on the right lines though. (As written, the PString 
includes a zero terminator, but that can easily be eliminated.)

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

typedef struct PascalString {
   int size;
   char *string;
} PString;

PString newPascalString(char *stringC) {
   int i;
   int length = strlen(stringC);
   PString pascal_string;
   pascal_string.size = length;
   pascal_string.string = malloc(length+1);
   strcpy(pascal_string.string, stringC);

   return pascal_string;
}

void printPascalString(PString ps) {
if (ps.size)
    printf("%.*s",ps.size,ps.string);
}

int main()
{
   char *c_string = "Mississippi";
   PString ps;
   ps = newPascalString(c_string);

   printPascalString(ps);
   puts("");

   return 0;
}

-- 
Bartc

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


#55283

FromDexterr <dejangru@gmail.com>
Date2014-12-22 06:55 -0800
Message-ID<ce331436-73ce-4d79-8703-4a9ddaacbba2@googlegroups.com>
In reply to#55281
On Monday, December 22, 2014 3:22:06 PM UTC+1, Bart wrote:
> On 22/12/2014 14:08, Dexterr wrote:
> 
> > This is my ... solution for converting C strings in Pascal strings.
> >
> > #include <stdio.h>
> > #include <stdlib.h>
> >
> > typedef struct PascalString {
> >    int size;
> >    char *string;
> > } PString;
> >
> > struct PascalString *newPascalString(char *stringC) {
> >    int i;
> >    PString *pascal_string = malloc(sizeof(struct PascalString));
> >    pascal_string->size = 11;
> >    pascal_string->string = malloc(sizeof(char) * pascal_string->size);
> >
> >    for(i = 0; i < pascal_string->size; i++) {
> >      pascal_string[i]->string = stringC[i];  // here is my problem
> >    }
> >    return pascal_string;
> > }
> >
> > int main()
> > {
> >    char *c_string = "Mississippi";
> >    newPascalString(c_string);
> >    return 0;
> > }
> 
> Your approach seems wrong. I revised your code to end up with the 
> following, which seems to work, although I haven't had time to test it 
> fully. It should be on the right lines though. (As written, the PString 
> includes a zero terminator, but that can easily be eliminated.)
> 
> #include <stdio.h>
> #include <stdlib.h>
> #include <string.h>
> 
> typedef struct PascalString {
>    int size;
>    char *string;
> } PString;
> 
> PString newPascalString(char *stringC) {
>    int i;
>    int length = strlen(stringC);
>    PString pascal_string;
>    pascal_string.size = length;
>    pascal_string.string = malloc(length+1);
>    strcpy(pascal_string.string, stringC);
> 
>    return pascal_string;
> }
> 
> void printPascalString(PString ps) {
> if (ps.size)
>     printf("%.*s",ps.size,ps.string);
> }
> 
> int main()
> {
>    char *c_string = "Mississippi";
>    PString ps;
>    ps = newPascalString(c_string);
> 
>    printPascalString(ps);
>    puts("");
> 
>    return 0;
> }
> 
> -- 
> Bartc

Thanks Mr Bart but it's not allowed to use a string.h function. Thats a problem. 

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


#55284

FromMalcolm McLean <malcolm.mclean5@btinternet.com>
Date2014-12-22 07:36 -0800
Message-ID<1dd7d9d5-f67c-4f12-9f95-b8a6276fdee2@googlegroups.com>
In reply to#55283
On Monday, December 22, 2014 2:55:19 PM UTC, Dexterr wrote:
> 
> Thanks Mr Bart but it's not allowed to use a string.h function.
>  Thats a problem.
>
Ah, so it is homework.

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


#55285

FromDexterr <dejangru@gmail.com>
Date2014-12-22 07:43 -0800
Message-ID<3be8a3a3-eabd-4782-b600-631724e52f84@googlegroups.com>
In reply to#55284
On Monday, December 22, 2014 4:36:10 PM UTC+1, Malcolm McLean wrote:
> On Monday, December 22, 2014 2:55:19 PM UTC, Dexterr wrote:
> > 
> > Thanks Mr Bart but it's not allowed to use a string.h function.
> >  Thats a problem.
> >
> Ah, so it is homework.

No, it's not a homework. Its one exercise I have found and you know what ? Sometimes smart people are so stupid. 

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


#55286

FromRichard Heathfield <invalid@see.sig.invalid>
Date2014-12-22 15:49 +0000
Message-ID<y4Xlw.190321$607.162188@fx21.am4>
In reply to#55284
Malcolm McLean wrote:

> On Monday, December 22, 2014 2:55:19 PM UTC, Dexterr wrote:
>> 
>> Thanks Mr Bart but it's not allowed to use a string.h function.
>>  Thats a problem.
>>
> Ah, so it is homework.

Wasn't that obvious from the outset?

The solution to his technical problem is, of course, trivial, but the 
solution to his social education issues may turn out to be intractable. When 
he eventually secures his first interview, I hope someone thinks to video 
it. It will go viral with blistering speed.

-- 
Richard Heathfield
Email: rjh at cpax dot org dot uk
"Usenet is a strange place" - dmr 29 July 1999
Sig line 4 vacant - apply within

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


#55287

FromDexterr <dejangru@gmail.com>
Date2014-12-22 08:01 -0800
Message-ID<d41bfc08-d65b-4ae1-b512-95cf5983d357@googlegroups.com>
In reply to#55286
On Monday, December 22, 2014 4:49:59 PM UTC+1, Richard Heathfield wrote:
> Malcolm McLean wrote:
> 
> > On Monday, December 22, 2014 2:55:19 PM UTC, Dexterr wrote:
> >> 
> >> Thanks Mr Bart but it's not allowed to use a string.h function.
> >>  Thats a problem.
> >>
> > Ah, so it is homework.
> 
> Wasn't that obvious from the outset?
> 
> The solution to his technical problem is, of course, trivial, but the 
> solution to his social education issues may turn out to be intractable. When 
> he eventually secures his first interview, I hope someone thinks to video 
> it. It will go viral with blistering speed.
> 
> -- 
> Richard Heathfield
> Email: rjh at cpax dot org dot uk
> "Usenet is a strange place" - dmr 29 July 1999
> Sig line 4 vacant - apply within

How you will learn programming if you don't have books with exercises ? How the fuck you will learn programming if you don't search for exercises ? How, just tell me you motherfucker ? What a homework in fucking Bosnia ? Nobody leran a C Programming at fucking school. This is not USA or GB you motherfucker. Here pupils still learn Pascal in school. Here will be a war again and you are making a problem if someone has a problem with his fucking homework. I have no homework, what the fuck should I do to prove it. I am just traying to understand how fucking structures, dynamic allocation in memory works in C, these days. Thats all!

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


#55292

FromRichard Heathfield <invalid@see.sig.invalid>
Date2014-12-22 16:34 +0000
Message-ID<1KXlw.252791$p95.226633@fx38.am4>
In reply to#55287
Dexterr wrote:

> On Monday, December 22, 2014 4:49:59 PM UTC+1, Richard Heathfield wrote:
>> Malcolm McLean wrote:
>> 
>> > On Monday, December 22, 2014 2:55:19 PM UTC, Dexterr wrote:
>> >> 
>> >> Thanks Mr Bart but it's not allowed to use a string.h function.
>> >>  Thats a problem.
>> >>
>> > Ah, so it is homework.
>> 
>> Wasn't that obvious from the outset?
>> 
>> The solution to his technical problem is, of course, trivial, but the
>> solution to his social education issues may turn out to be intractable.
>> When he eventually secures his first interview, I hope someone thinks to
>> video it. It will go viral with blistering speed.
>> 
> How you will learn programming if you don't have books with exercises ?

Exercises are basically homework. This newsgroup has frequently helped 
students with homework, although we tend to draw the line at doing the 
homework for you. Of course, those students were able to communicate rather 
more effectively than you. You need to work on those communications skills.

> How the fuck you will learn programming if you don't search for exercises
> ? How, just tell me you motherfucker ? What a homework in fucking Bosnia ?
> Nobody leran a C Programming at fucking school. This is not USA or GB you
> motherfucker. Here pupils still learn Pascal in school. Here will be a war
> again and you are making a problem if someone has a problem with his
> fucking homework. I have no homework, what the fuck should I do to prove
> it. I am just traying to understand how fucking structures, dynamic
> allocation in memory works in C, these days. Thats all!

You're so cute! :-)

And because you're so cute, I'm going to give you some hints:

1) before asking for help with your homework (or exercises, or whatever you 
want to call it), try to do it on your own. If you get stuck, prepare the 
following material:
i) the problem specification;
ii) your best effort at solving the problem for yourself (source code);
iii) a list of any diagnostic messages (warnings and errors) that you don't 
understand;
iv) if the program runs, your explanation of where you think it's going 
wrong (what it should do but doesn't, or what it shouldn't do but does);

2) once you've prepared all that, you're in a position to write your Usenet 
article - but be sure to check the FAQs to make sure that your question 
isn't answered there (if it is, job done);

3) keep your Usenet article as brief as possible without losing important 
detail, and as polite as possible - this generally involves not swearing and 
not insulting people. Swearing and insults DO NOT HELP YOU. They just stop 
smart people from answering you. If you insist on swearing at people, the 
only people who will help you are boneheads;

4) keep an eye on the resulting discussion and be prepared to answer any 
questions that may be asked of you (e.g. clarifications of the problem 
statement);

5) be prepared to learn things that you might not be expecting to learn;

6) having learned something, don't forget it - people will be patient up to 
a point, but eventually they get sick and tired of teaching the same thing 
to the same person over and over again.

There - lots and lots of friendly, helpful, useful advice, even though your 
manners are execrable.

What happens next? Well, what happens next is that you get another chance. 
You get a chance to not be a moron. You get a chance to clean up your 
language and your attitude and stop treating people like dirt.

If you take that opportunity, maybe the smart people in this group will be 
more willing to help you. But if you don't, you'll end up talking only to 
people who don't know much more about C than you do.

And note 1)ii) above, which would have saved you a lot of aggravation.

-- 
Richard Heathfield
Email: rjh at cpax dot org dot uk
"Usenet is a strange place" - dmr 29 July 1999
Sig line 4 vacant - apply within

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


#55294

FromDexterr <dejangru@gmail.com>
Date2014-12-22 08:46 -0800
Message-ID<7d81f57f-e5ac-4f0f-9f5e-bfbef1afe9bf@googlegroups.com>
In reply to#55292
On Monday, December 22, 2014 5:34:13 PM UTC+1, Richard Heathfield wrote:
> Dexterr wrote:
> 
> > On Monday, December 22, 2014 4:49:59 PM UTC+1, Richard Heathfield wrote:
> >> Malcolm McLean wrote:
> >> 
> >> > On Monday, December 22, 2014 2:55:19 PM UTC, Dexterr wrote:
> >> >> 
> >> >> Thanks Mr Bart but it's not allowed to use a string.h function.
> >> >>  Thats a problem.
> >> >>
> >> > Ah, so it is homework.
> >> 
> >> Wasn't that obvious from the outset?
> >> 
> >> The solution to his technical problem is, of course, trivial, but the
> >> solution to his social education issues may turn out to be intractable.
> >> When he eventually secures his first interview, I hope someone thinks to
> >> video it. It will go viral with blistering speed.
> >> 
> > How you will learn programming if you don't have books with exercises ?
> 
> Exercises are basically homework. This newsgroup has frequently helped 
> students with homework, although we tend to draw the line at doing the 
> homework for you. Of course, those students were able to communicate rather 
> more effectively than you. You need to work on those communications skills.
> 
> > How the fuck you will learn programming if you don't search for exercises
> > ? How, just tell me you motherfucker ? What a homework in fucking Bosnia ?
> > Nobody leran a C Programming at fucking school. This is not USA or GB you
> > motherfucker. Here pupils still learn Pascal in school. Here will be a war
> > again and you are making a problem if someone has a problem with his
> > fucking homework. I have no homework, what the fuck should I do to prove
> > it. I am just traying to understand how fucking structures, dynamic
> > allocation in memory works in C, these days. Thats all!
> 
> You're so cute! :-)
> 
> And because you're so cute, I'm going to give you some hints:
> 
> 1) before asking for help with your homework (or exercises, or whatever you 
> want to call it), try to do it on your own. If you get stuck, prepare the 
> following material:
> i) the problem specification;
> ii) your best effort at solving the problem for yourself (source code);
> iii) a list of any diagnostic messages (warnings and errors) that you don't 
> understand;
> iv) if the program runs, your explanation of where you think it's going 
> wrong (what it should do but doesn't, or what it shouldn't do but does);
> 
> 2) once you've prepared all that, you're in a position to write your Usenet 
> article - but be sure to check the FAQs to make sure that your question 
> isn't answered there (if it is, job done);
> 
> 3) keep your Usenet article as brief as possible without losing important 
> detail, and as polite as possible - this generally involves not swearing and 
> not insulting people. Swearing and insults DO NOT HELP YOU. They just stop 
> smart people from answering you. If you insist on swearing at people, the 
> only people who will help you are boneheads;
> 
> 4) keep an eye on the resulting discussion and be prepared to answer any 
> questions that may be asked of you (e.g. clarifications of the problem 
> statement);
> 
> 5) be prepared to learn things that you might not be expecting to learn;
> 
> 6) having learned something, don't forget it - people will be patient up to 
> a point, but eventually they get sick and tired of teaching the same thing 
> to the same person over and over again.
> 
> There - lots and lots of friendly, helpful, useful advice, even though your 
> manners are execrable.
> 
> What happens next? Well, what happens next is that you get another chance. 
> You get a chance to not be a moron. You get a chance to clean up your 
> language and your attitude and stop treating people like dirt.
> 
> If you take that opportunity, maybe the smart people in this group will be 
> more willing to help you. But if you don't, you'll end up talking only to 
> people who don't know much more about C than you do.
> 
> And note 1)ii) above, which would have saved you a lot of aggravation.
> 
> -- 
> Richard Heathfield
> Email: rjh at cpax dot org dot uk
> "Usenet is a strange place" - dmr 29 July 1999
> Sig line 4 vacant - apply within

Thanks Mr Richard,

I will do my best to follow your instructions. This was friendly and I will do it. 

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


#55434

FromJohannes Bauer <dfnsonfsduifb@gmx.de>
Date2014-12-25 15:36 +0100
Message-ID<m7h7dq$35e$1@news.albasani.net>
In reply to#55294
On 22.12.2014 17:46, Dexterr wrote:

> I will do my best to follow your instructions. This was friendly and I will do it. 

Awww, that deescalated quickly ;-(

SCNR,
Johannes

-- 
>> Wo hattest Du das Beben nochmal GENAU vorhergesagt?
> Zumindest nicht öffentlich!
Ah, der neueste und bis heute genialste Streich unsere großen
Kosmologen: Die Geheim-Vorhersage.
 - Karl Kaos über Rüdiger Thomas in dsa <hidbv3$om2$1@speranza.aioe.org>

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


#55440

FromDexterr <dejangru@gmail.com>
Date2014-12-25 13:14 -0800
Message-ID<67ba6e90-7263-4a59-9ae0-266f5cf45563@googlegroups.com>
In reply to#55434
On Thursday, December 25, 2014 3:36:50 PM UTC+1, Johannes Bauer wrote:
> On 22.12.2014 17:46, Dexterr wrote:
> 
> > I will do my best to follow your instructions. This was friendly and I will do it. 
> 
> Awww, that deescalated quickly ;-(
> 
> SCNR,
> Johannes
> 

Ich verstehe gar nicht was Sie meinen ? Können Sie ein bisshen konkret sein ? ;)

Lg
Dejan

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


#55296

FromMalcolm McLean <malcolm.mclean5@btinternet.com>
Date2014-12-22 09:24 -0800
Message-ID<655de0ea-a785-4e39-bacf-62088e5889b4@googlegroups.com>
In reply to#55286
On Monday, December 22, 2014 3:49:59 PM UTC, Richard Heathfield wrote:
> Malcolm McLean wrote:
> 
> > Ah, so it is homework.
> 
> Wasn't that obvious from the outset?
> 
Not to me.
I'm frequently presented with the zippy super-language that is the
solution to all our software engineering problems, and comes
with its own easier to use version of printf().
After taking a brief look at the syntax, my first question is usually
"How do you interface this with C?". If the answer is halfway
usable, we're in business. I write little stub routines to 
hook up C to zippy super-language, and we've got access to a massive
corpus of efficient, tested, reusable C source.

One thing that zippy super-language is bound to do is to attach
a length field to a string. It's such an obvious optimisation to
C asciiz strings that everyone does that. But of course if string
handling really is your bottleneck, you're going to need suffix trees
and hashes. Good luck reimplementing them in zippy-super language.
A little routine to convert a zippy string into a C string and back
will just do the job.

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


#55298

FromBartC <bc@freeuk.com>
Date2014-12-22 17:49 +0000
Message-ID<KQYlw.138912$7u3.42084@fx47.am4>
In reply to#55283
On 22/12/2014 14:55, Dexterr wrote:

> Thanks Mr Bart but it's not allowed to use a string.h function. Thats a problem.

But are you allowed to create your own versions? Here I've created a 
version of strlen(), and replaces strcpy() by a loop (but it no longer 
copies the terminating zero).

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

typedef struct PascalString {
   int size;
   char *string;
} PString;

int mystrlen(char* s) {
   int length=0;
   if (s==NULL) return 0;
   while (*s++) ++length;
   return length;
}

PString newPascalString(char *stringC) {
   int i;
   int length = mystrlen(stringC);

   PString pascal_string;
   pascal_string.size = length;
   pascal_string.string = malloc(length);
   for (i=0; i<length; ++i) pascal_string.string[i]=stringC[i];

   return pascal_string;
}

void printPascalString(PString ps) {
if (ps.size)
    printf("%.*s",ps.size,ps.string);
}

int main()
{
   char *c_string = "Mississippi";
   PString ps;
   ps = newPascalString(c_string);

   printPascalString(ps);
   puts("");

   return 0;
}

-- 
Bartc

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


#55302

FromDexterr <dejangru@gmail.com>
Date2014-12-22 10:55 -0800
Message-ID<0cd4a139-c466-4c04-95cc-f4436be0034c@googlegroups.com>
In reply to#55298
On Monday, December 22, 2014 6:49:39 PM UTC+1, Bart wrote:
> On 22/12/2014 14:55, Dexterr wrote:
> 
> > Thanks Mr Bart but it's not allowed to use a string.h function. Thats a problem.
> 
> But are you allowed to create your own versions? Here I've created a 
> version of strlen(), and replaces strcpy() by a loop (but it no longer 
> copies the terminating zero).
> 
> #include <stdio.h>
> #include <stdlib.h>
> 
> typedef struct PascalString {
>    int size;
>    char *string;
> } PString;
> 
> int mystrlen(char* s) {
>    int length=0;
>    if (s==NULL) return 0;
>    while (*s++) ++length;
>    return length;
> }
> 
> PString newPascalString(char *stringC) {
>    int i;
>    int length = mystrlen(stringC);
> 
>    PString pascal_string;
>    pascal_string.size = length;
>    pascal_string.string = malloc(length);
>    for (i=0; i<length; ++i) pascal_string.string[i]=stringC[i];
> 
>    return pascal_string;
> }
> 
> void printPascalString(PString ps) {
> if (ps.size)
>     printf("%.*s",ps.size,ps.string);
> }
> 
> int main()
> {
>    char *c_string = "Mississippi";
>    PString ps;
>    ps = newPascalString(c_string);
> 
>    printPascalString(ps);
>    puts("");
> 
>    return 0;
> }
> 
> -- 
> Bartc

Thanks Mr Bart.

This solution is great. I have learn a lot from this. But, one more question. In valgrind there is a memory leak. I am not good in memory dinamic allocation. 
Probably we should free some memory. Maybe the answer is here pascal_string.string = malloc(length); 

Now, I am not sure where to put free ? In main or newPascalString function ?

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


#55304

FromBartC <bc@freeuk.com>
Date2014-12-22 19:33 +0000
Message-ID<ym_lw.254716$EJ7.87926@fx18.am4>
In reply to#55302
On 22/12/2014 18:55, Dexterr wrote:
> On Monday, December 22, 2014 6:49:39 PM UTC+1, Bart wrote:

>> PString newPascalString(char *stringC) {

>>     pascal_string.string = malloc(length);

>>     return pascal_string;

>>     ps = newPascalString(c_string);
>>
>>     printPascalString(ps);

> This solution is great. I have learn a lot from this. But, one more question. In valgrind there is a memory leak. I am not good in memory dinamic allocation.
> Probably we should free some memory. Maybe the answer is here pascal_string.string = malloc(length);
>
> Now, I am not sure where to put free ? In main or newPascalString function ?

Yes, a PString object initialised from newPascalString() will contain 
some allocated memory.

You would deallocate this (using a function such as freePascalString() 
perhaps), when you no longer need the string. However you don't really 
need to free when it runs into the end of the program anyway. Maybe 
that's what Valgrind is reporting.

You will probably come across plenty of memory problems anyway (that's 
what C pointers are all about). For example:

  PString ps1, ps2;

  ps1 = newPascalString("ONE");
  ps2 = ps1;

Now ps1 and ps2 share the same string. If you free ps1, then ps2 points 
to garbage. You might want to initialise PStrings too:

  PString ps1 = {0,0}; // or {-1,0}

to ensure you don't try and use a Pstring that contains garbage (and 
freeing a PString might set it to {0,0} for the same reason.)

Note: for empty strings, newPascalstring() uses malloc(0). As far as I 
know this is well-behaved, but you might choose to store a NULL pointer 
instead when length==0. I would prefer a pointer there; even better, add 
the zero terminating byte of the string, then there will always be at 
least one byte of allocation, and makes it easier to interact with C 
functions that use strings.

-- 
Bartc

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


#55305

FromRichard Heathfield <invalid@see.sig.invalid>
Date2014-12-22 19:41 +0000
Message-ID<Pt_lw.243014$v42.51757@fx19.am4>
In reply to#55302
Dexterr wrote:

> On Monday, December 22, 2014 6:49:39 PM UTC+1, Bart wrote:
>> On 22/12/2014 14:55, Dexterr wrote:
>> 
>> > Thanks Mr Bart but it's not allowed to use a string.h function. Thats a
>> > problem.
>> 
>> But are you allowed to create your own versions? Here I've created a
>> version of strlen(), and replaces strcpy() by a loop (but it no longer
>> copies the terminating zero).
>> 
>> #include <stdio.h>
>> #include <stdlib.h>
>> 
>> typedef struct PascalString {
>>    int size;
>>    char *string;
>> } PString;
>> 
>> int mystrlen(char* s) {
>>    int length=0;
>>    if (s==NULL) return 0;
>>    while (*s++) ++length;
>>    return length;
>> }
>> 
>> PString newPascalString(char *stringC) {
>>    int i;
>>    int length = mystrlen(stringC);
>> 
>>    PString pascal_string;
>>    pascal_string.size = length;
>>    pascal_string.string = malloc(length);
>>    for (i=0; i<length; ++i) pascal_string.string[i]=stringC[i];
>> 
>>    return pascal_string;
>> }
>> 
>> void printPascalString(PString ps) {
>> if (ps.size)
>>     printf("%.*s",ps.size,ps.string);
>> }
>> 
>> int main()
>> {
>>    char *c_string = "Mississippi";
>>    PString ps;
>>    ps = newPascalString(c_string);
>> 
>>    printPascalString(ps);
>>    puts("");
>> 
>>    return 0;
>> }
>> 
>> --
>> Bartc
> 
> Thanks Mr Bart.
> 
> This solution is great. I have learn a lot from this. But, one more
> question. In valgrind there is a memory leak. I am not good in memory
> dinamic allocation. Probably we should free some memory. Maybe the answer
> is here pascal_string.string = malloc(length);
> 
> Now, I am not sure where to put free ? In main or newPascalString function
> ?

newPascalString() allocates storage for a Pascal-style string. If you 
release the storage at that point, you can't use the string.

main() contains the high-level logic of the program. Releasing one memory 
block in main() won't do you much harm, but it's not really what main is 
for.

The right way to do this is (if do it one must) is to put all the Pascal 
string code into a library, and this should include a mechanism for 
destroying the string.

Something like this:

/******** pascalstring.h ***********/
#ifndef H_PASCALSTRING
#define H_PASCALSTRING 1
#include <stdio.h>
typedef struct t_pascalstring_ t_pascalstring;
t_pascalstring *pascalstring_create(const char *);
int pascalstring_write(FILE *, const t_pascalstring *);
int pascalstring_getlength(const t_pascalstring *);
void pascalstring_destroy(t_pascalstring **);
#endif
/******** pascalstring.h ***********/

/******** pascalstring.c ***********/
#include "pascalstring.h"
#include <stdlib.h>
#include <string.h> /* see below */
#include <limits.h>

struct t_pascalstring_
{
  unsigned char size;
  char *ps;
};

t_pascalstring *pascalstring_create(const char *s)
{
  size_t len = 0;
  int okay = 1;
  t_pascalstring *new = NULL;
  if(s != NULL && *s != '\0')
  {
    new = malloc(sizeof *new);
    if(new == NULL)
    {
      okay = 0;
    }
    else
    {
      new->ps = NULL;
      new->size = 0;
    }
  }
  if(okay)
  {
    len = strlen(s);
    if(len > UCHAR_MAX)
    {
      okay = 0;
    }
  }
  if(okay)
  {
    new->ps = malloc(len);
    if(new->ps != NULL)
    {
      memcpy(new->ps, s, len); /* see below */
      new->size = len;
    }
    else
    {
      okay = 0;
    }
  }
  if(!okay)
  {
    pascalstring_destroy(&new);
  }
  return new;
}
int pascalstring_write(FILE *fpout, const t_pascalstring *ps)
{
  int rc = -1; /* error return */
  if(fpout != NULL && ps != NULL)
  {
    rc = fprintf(fpout,
                 "%.*s",
                 pascalstring_getlength(ps), ps->ps);
  }
  return rc;
}
int pascalstring_getlength(const t_pascalstring *ps)
{
  int rc = -1;
  if(ps != NULL)
  {
    rc = ps->size;
  }
  return rc;
}
void pascalstring_destroy(t_pascalstring **old)
{
  if(old != NULL)
  {
    if(*old != NULL)
    {
      free((*old)->ps);
      free(*old);
      *old = NULL;
    }
  }
}
/******** pascalstring.c ***********/

/******** main.c ***********/
#include <stdio.h>
#include <stdlib.h>
#include "pascalstring.h"

int main(void)
{
  int rc = -1;
  const char *cs = "Mississippi";
  t_pascalstring *p = pascalstring_create(cs);
  if(p != NULL)
  {
    rc = pascalstring_write(stdout, p);
    putchar('\n');
    pascalstring_destroy(&p);
  }
  return rc == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}

/******** main.c ***********/

Note: if you really aren't allowed to use <string.h>, the ONLY thing you 
have to do is write this:

void my_memcpy(void *vleft, const void *vright, size_t len)
{
  unsigned char *left = vleft;
  unsigned char *right = vright;
  while(len--)
  {
    *left++ = *right++;
  }
}

and then replace

memcpy(new->ps, s, len);

with

my_memcpy(new->ps, s, len);


What this gives you is a robust type that is easily extensible but difficult 
for calling code to break (not impossible, mark you - but difficult). I 
invite you to compare and contrast this response with other technical 
responses you've received. In what ways is it similar? In what ways is it 
different? Do you understand why it's different? What advantages and 
disadvantages does my way of writing the code entail?

All these are important questions - far more important, in fact, than the 
actual exercise.

-- 
Richard Heathfield
Email: rjh at cpax dot org dot uk
"Usenet is a strange place" - dmr 29 July 1999
Sig line 4 vacant - apply within

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


#55313

FromBartC <bc@freeuk.com>
Date2014-12-22 22:35 +0000
Message-ID<011mw.191541$812.115671@fx20.am4>
In reply to#55305
On 22/12/2014 19:41, Richard Heathfield wrote:
> Dexterr wrote:

>      new = malloc(sizeof *new);
>      if(new == NULL)
....
>      new->ps = malloc(len);
>      if(new->ps != NULL)
....

> Note: if you really aren't allowed to use <string.h>, the ONLY thing you
> have to do is write this:
....

And maybe fix the call to strlen().

> What this gives you is a robust type that is easily extensible but difficult
> for calling code to break (not impossible, mark you - but difficult). I
> invite you to compare and contrast this response with other technical
> responses you've received. In what ways is it similar? In what ways is it
> different? Do you understand why it's different? What advantages and
> disadvantages does my way of writing the code entail?

(1) You prefer to pass around Pstring* objects instead of. That's fine; 
it makes some things easier. But it means having two levels of 
indirection to the actual string (and two lots of allocation and 
freeing). You might as well have the actual string next to the length 
(but requires a 'struct hack')

(2) You're checking malloc() returns at every step. I suppose if calling 
malloc() directly this has to be done, but I think this level of 
checking belongs elsewhere. If there is a malloc failure, there there is 
a bigger problem than not being able to allocate a string.

But the real issue is now having the onus on the callers of these 
functions to check every single call for success.

(3) (You've gone back to using a single byte code for the string length, 
even though the OP decided to use an int. And that count field is likely 
padded out to an int anyway. But this depends on how important the 
Pascal compatibility is; no solution presented so far will exactly match 
how Pascal is likely to implement it.)

-- 
A Bonehead

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


#55314

FromRichard Heathfield <invalid@see.sig.invalid>
Date2014-12-22 22:41 +0000
Message-ID<o61mw.244322$v42.198197@fx19.am4>
In reply to#55313
BartC wrote:

> On 22/12/2014 19:41, Richard Heathfield wrote:
>> Dexterr wrote:
> 
>>      new = malloc(sizeof *new);
>>      if(new == NULL)
> ....
>>      new->ps = malloc(len);
>>      if(new->ps != NULL)
> ....
> 
>> Note: if you really aren't allowed to use <string.h>, the ONLY thing you
>> have to do is write this:
> ....
> 
> And maybe fix the call to strlen().

Oops!

size_t my_strlen(const char *s)
{
  size_t len = 0;
  if(s != NULL)
  {
    while(*s++)
    {
      ++len;
    }
  }
  return len;
}

> 
>> What this gives you is a robust type that is easily extensible but
>> difficult for calling code to break (not impossible, mark you - but
>> difficult). I invite you to compare and contrast this response with other
>> technical responses you've received. In what ways is it similar? In what
>> ways is it different? Do you understand why it's different? What
>> advantages and disadvantages does my way of writing the code entail?
> 
> (1) You prefer to pass around Pstring* objects instead of. That's fine;
> it makes some things easier. But it means having two levels of
> indirection to the actual string (and two lots of allocation and
> freeing).

This is, however, invisible to the caller. There is no real downside.

> You might as well have the actual string next to the length
> (but requires a 'struct hack')

...which I have always thought to be ugly.

> (2) You're checking malloc() returns at every step.

Of course. To do otherwise would be careless.

> I suppose if calling
> malloc() directly this has to be done, but I think this level of
> checking belongs elsewhere. If there is a malloc failure, there there is
> a bigger problem than not being able to allocate a string.

Yes, but that's the caller's decision to make.

> 
> But the real issue is now having the onus on the callers of these
> functions to check every single call for success.

That's not an issue, is it? It's just part of robust programming.

> 
> (3) (You've gone back to using a single byte code for the string length,
> even though the OP decided to use an int.

Oh, I missed that. Thanks for pointing it out. The fix is an easy one.

<snip>

-- 
Richard Heathfield
Email: rjh at cpax dot org dot uk
"Usenet is a strange place" - dmr 29 July 1999
Sig line 4 vacant - apply within

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


#55322

FromMalcolm McLean <malcolm.mclean5@btinternet.com>
Date2014-12-22 16:16 -0800
Message-ID<2a3a2358-7726-4c79-9e46-3bfd565253bc@googlegroups.com>
In reply to#55313
On Monday, December 22, 2014 10:35:49 PM UTC, Bart wrote:
> 
> (3) (You've gone back to using a single byte code for the string length, 
> even though the OP decided to use an int. And that count field is likely 
> padded out to an int anyway. But this depends on how important the 
> Pascal compatibility is; no solution presented so far will exactly match 
> how Pascal is likely to implement it.)
> 
You want to pass the Pascal string around as bit buffers. Internally
Pascal may store as length byte + characters, 2 length bytes +
characters, 4 length bytes + characters, the size_t answer of 8 
length bytes + characters, and it might even use non-native endianness.

it's only a minor problem. We provide

int (size_t if you must) getlength(void *pascal_string)

and

char *getcharacters(void *pascal_string)

those we might have to change. If you want to create a maintenance 
headache, #define PASCAL_LENGTH bytes. Personally I'd just note that
these functions need updating as and when the Pascal representation
changes / better documentation becomes available.

The idea is that we can create a string in C, and pass it to
the Pascal system, where it will treat it as native, and take
one in from Pascal and parse it in C.

 
  

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


#55323

FromIan Collins <ian-news@hotmail.com>
Date2014-12-23 13:18 +1300
Message-ID<cfrqnjFim7bU8@mid.individual.net>
In reply to#55322
Malcolm McLean wrote:
> On Monday, December 22, 2014 10:35:49 PM UTC, Bart wrote:
>>
>> (3) (You've gone back to using a single byte code for the string length,
>> even though the OP decided to use an int. And that count field is likely
>> padded out to an int anyway. But this depends on how important the
>> Pascal compatibility is; no solution presented so far will exactly match
>> how Pascal is likely to implement it.)
>>
> You want to pass the Pascal string around as bit buffers. Internally
> Pascal may store as length byte + characters, 2 length bytes +
> characters, 4 length bytes + characters, the size_t answer of 8
> length bytes + characters, and it might even use non-native endianness.
>
> it's only a minor problem. We provide
>
> int (size_t if you must) getlength(void *pascal_string)
>
> and
>
> char *getcharacters(void *pascal_string)

You'd want "const char*" there.  Messing with the characters and 
inadvertently changing the size isn't a good idea.

-- 
Ian Collins

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


Page 1 of 11  [1] 2 3 … 11  Next page →

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


csiph-web