Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site gatech.UUCP Path: utzoo!watmath!clyde!burl!ulysses!gatech!arnold From: arnold@gatech.UUCP (Arnold Robbins) Newsgroups: net.lang.c Subject: Re: C declarations Message-ID: <11807@gatech.UUCP> Date: Wed, 30-Jan-85 12:23:29 EST Article-I.D.: gatech.11807 Posted: Wed Jan 30 12:23:29 1985 Date-Received: Thu, 31-Jan-85 03:22:02 EST References: <7699@brl-tgr.ARPA> <1293@bbncca.ARPA> Organization: Firefighters Extraordinaire, Inc. Lines: 27 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 */ since there is no difference between pointing to a single int, or the first element in an array. I heartily agree that pointers and array are probably the most confusing aspect of C. -- Arnold Robbins CSNET: arnold@gatech ARPA: arnold%gatech.csnet@csnet-relay.arpa UUCP: { akgua, allegra, hplabs, ihnp4, seismo, ut-sally }!gatech!arnold Help advance the state of Computer Science: Nuke a PR1ME today!