From: "Björn Persson" <spam-away@nowhere.nil>
Subject: Re: count_string program
Date: Fri, 27 Feb 2004 18:29:38 GMT
Date: 2004-02-27T18:29:38+00:00 [thread overview]
Message-ID: <m0M%b.50584$mU6.203569@newsb.telia.net> (raw)
In-Reply-To: <6MB%b.69233$4o.90172@attbi_s52>
tmoran@acm.org wrote:
> In the real world, you can probably assume most
> users won't enter more than, say, 1,000 characters, so you could specify
> that your program only handles a maximum of 1,000, and then declare
>
> Input : String(1 .. 1000);
You (Cecilia) could do that, but if you need to store the string it's
because you want to use it later. Then you will most likely need to know
how many of those 1000 positions are used and how many contain garbage.
That is, you have to keep track of the actual length of the string
separately. Since there are string types in the standard library that
keep track of the length automatically, it's better to use them.
--
Björn Persson
jor ers @sv ge.
b n_p son eri nu
next prev parent reply other threads:[~2004-02-27 18:29 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-02-26 9:10 count_string program Cecilia Chew
2004-02-26 10:17 ` Jacob Sparre Andersen
2004-02-27 3:13 ` Cecilia Chew
2004-02-27 11:00 ` Jacob Sparre Andersen
2004-02-26 15:43 ` Björn Persson
2004-02-27 3:19 ` Cecilia Chew
2004-02-27 6:49 ` tmoran
2004-02-27 18:29 ` Björn Persson [this message]
2004-02-27 13:28 ` Stephen Leake
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox