Morris Dovey wrote:
> sheroork (in m)
> said:
>
> | Can anyone help me in getting to understand pointer to pointer with
> | examples?
>
> Sagar...
>
> The explanations posted so far look good. These two links make up
> another example of how pointers to pointers might be used:
>
> http://www.iedu.com/mrd/c/tokenize.c
> http://www.iedu.com/mrd/c/tokfile.c
They look more like an example of how not to write C to me.
Rather than having a tokenize.h containing the prototype for the
tokenize function it has the prototype repeated in tokfile.c. So you
have to maintain it in two places with no help from the compiler.
Using a file scope variable for the function to determine if a character
is a word separator or part of a word instead of passing it down. What
is worse, a single character name for it!
Assuming ASCII or similar character encoding instead of using the
portable standard is* functions.
Increasing the hard to follow coupling by using another file scope
variable s to hold a pointer to the character being processed. The
author seems to have a major objection to using parameters!
Using recursion for what could more simply be implemented with a for
loop, and the state being passed down via the afore mentioned file scope
variables instead of parameters!
That code is so needlessly convoluted that pointing a beginner at it is
tantamount to cruelty!
--
Flash Gordon
Still sigless on this computer.