Array Problems

Richard A. O'Keefe ok at goanna.cs.rmit.oz.au
Mon May 27 19:04:56 AEST 1991


This is not the real problem, but in article <14724 at ucrmath.ucr.edu>,
duchow at watnxt3.ucr.edu (John Duchowski) writes:

> input(argc, argv, x, y, header)
> int			*argc;			<------
> char			*argv[];
  ...
> output(argc, argv, x, y, n, header)
> int		*argc;				<------
> char		*argv[];
  ...
> main(argc, argv)
> int	argc;
> char	*argv[];
> {
  ...
>    n = input(argc, argv, x, y, &header);	<------
 ...           ^^^^
>    output(argc, argv, x, y, n, &header);	<------
            ^^^^

That suggests that the functions should have been declared
	void input(argc, argv, x, y, header)
	    int argc;
	    char *argv[];
	    ...
	void output(argc, argv, x, y, n, header)
	    int argc;
	    char *argv[];
	    ...
and that there may be other problems lurking around that 'lint'
(surely the NeXt has 'lint'?) would catch.

Myself, I always write "char **argv;"; C doesn't really understand
arrays as parameters, and using a notation that suggests that it does
will only get you in trouble.
 
-- 
I rejoiced that at least So-and-So could spell "hierarchical",
but the _real_ explanation was that he couldn't spell "heir".	-me



More information about the Comp.lang.c mailing list