Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 (Tek) 9/28/84 based on 9/17/84; site azure.UUCP Path: utzoo!utcs!lsuc!pesnta!hplabs!tektronix!teklds!azure!annab From: annab@azure.UUCP (A Beaver) Newsgroups: net.lang.c Subject: Re: Pointer confusion -- forgot original title Message-ID: <104@azure.UUCP> Date: Tue, 19-Feb-85 16:05:53 EST Article-I.D.: azure.104 Posted: Tue Feb 19 16:05:53 1985 Date-Received: Fri, 22-Feb-85 01:10:16 EST Organization: The Den Lines: 27 >References: <677@ukma.UUCP> > In article <11807@gatech.UUCP>arnold@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[])". > -:--:- > 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@Tektronix