|
|
On 29 Apr, 13:27, arnuld <NoS...@xxxxxxxxxx> wrote:
> C takes input character by character.
nope. It can read lines (fgets()) or arbitary blocks (fread())
> I did not find any Standard Library
> function that can take a word as input.
correct, there aren't any.
> So I want to write one of my own
> to be used with "Self Referential Structures" of section 6.5 of K&R2. K&R2
> has their own version of <getword> which, I think, is quite different
> from what I need:
>
> <getword> will have following properties:
>
> 1.) If the word contains any number like "beauty1" or "win2e" it will
> discard it, K&R2's <getword> does not. My <getword> will only take
> pure-words like "beauty", "wine" etc.
take a look at isalpha()
> 2.) we can store each word by using <array of pointers> pointing to those
> words and since words themselves are strings, which in
> reality, are <arrays of chars>, so we will have <array of pointers> to
> those <arrays of chars>.
char *word_table [100];
> or you think using a 2D array is a better idea ?
are all your words the same size?
If you use the array of pointers you'll have to get the memory
for each word from somewhere (eg. malloc())
--
Nick Keighley
there may have been other things between sliced bread and Java
|
|