Pointer confusion -- forgot original title

A Beaver annab at azure.UUCP
Wed Feb 20 07:05:53 AEST 1985


>References: <677 at ukma.UUCP>
> In article <11807 at gatech.UUCP>arnold at gatech.UUCP (Arnold Robbins) writes:
> >Morris M. Keesan {decvax,linus,ihnp4,wivax,wjh12,ima}!bbncca!keesan writes:
> >>	[.....]
> >> 	int *ptr[];            /* ptr is a pointer to an array of int */
> >>	[.....]
> >Sorry, but this declaration means ptr is ->[an array of pointers to ints]
	 (similar
> >to the char *argv[] declaration of argv).
> >A pointer to an array of ints would be
> >	int array[] = { 1, 2, 3 };
> >	int *ptr = & array[0];	/* just use a simple pointer */
> >	/* or int *ptr = array; but that is what started this whole mess */
> 
> Sorry, you are wrong.  A "int **ptr" would be ->[an array of pointers to int]
> another way of declaring this is "int *(ptr[<length>])".
> -:--:-
> David Herron;
	It has been my understanding, that in USE "*ptr[]" and "**ptr" are
	essentially the same and can be used interchangably.
	However, at initialization you have to declare the size of the array
	as David says above.	The reason that you can get away with
	"char *argv[]", is because the number of arguments that is passed
	to the program environment is know.(in argc)	Am I wrong?

	 Annadiana Beaver
	A Beaver at Tektronix



More information about the Comp.lang.c mailing list