Re: count_string program
From: Björn Persson (spam-away_at_nowhere.nil)
Date: 02/27/04
- Previous message: Hyman Rosen: "Re: left-to-right (was In-Out Parameters for functions)"
- In reply to: tmoran_at_acm.org: "Re: count_string program"
- Next in thread: Stephen Leake: "Re: count_string program"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 27 Feb 2004 18:29:38 GMT
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
- Previous message: Hyman Rosen: "Re: left-to-right (was In-Out Parameters for functions)"
- In reply to: tmoran_at_acm.org: "Re: count_string program"
- Next in thread: Stephen Leake: "Re: count_string program"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|