Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!news.giganews.com.POSTED!not-for-mail NNTP-Posting-Date: Thu, 02 Jun 2011 21:06:19 -0500 From: Pete Becker Organization: Roundhouse Consulting, Ltd. Newsgroups: comp.lang.c++ Date: Thu, 2 Jun 2011 16:06:19 -1000 Message-ID: <2011060216061983880-pete@versatilecodingcom> References: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: Problem with array objects User-Agent: Unison/2.1.4 Lines: 43 X-Usenet-Provider: http://www.giganews.com X-Trace: sv3-6ap2fsshcQLFaLW4QhVxFKxEd+oONHK6Aj1UEFiIwdpfjDzSGlafgxAWQQh7Q2XglbjLOnTwK46TNFo!mgdXqIUs8BAgjlqEKlbxsWuleAV+IYYwsBI+RYS0eP2NIHNhQAsL9PP31xpbeVK6yyCcmvA= X-Complaints-To: abuse@giganews.com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 2655 Xref: x330-a1.tempe.blueboxinc.net comp.lang.c++:6114 On 2011-06-02 14:41:16 -1000, Paul said: > "Pete Becker" wrote in message > news:2011060210342271730-pete@versatilecodingcom... >> On 2011-06-02 09:23:12 -1000, Paul said: >> >>> >>> I am simply trying to get to the bottom of why you think a pointer of >>> type int* cannot point to an array of integer objects. >> >> The reason is simple: a pointer of type int* points to an int. That's >> what int* means. An int is not an array of integer objects. >> > int arr1[1]; > This is an int(singular) > int arr2[16]; > These are ints(plural) > A pointer to all these ints can be, and usually is, of type int*. A pointer to any of these ints is of type int*. There is no single pointer to all of these ints. > > A pointer references a memory location and when its dereferenced we get > the value from that location. > You cannot reference a whole array unless you have an array of > pointers. You can only represent a pointer to the whole array using the > C++ type system. > > I can appreciate both pointer types as pointing to an array of objects, > in different ways. I do not think that an int* cannot point to an array > of int objects. Which is what I said above: an int* points to an int. It does not point to an array of int objects, because an array of int objects is not an int. -- Pete Roundhouse Consulting, Ltd. (www.versatilecoding.com) Author of "The Standard C++ Library Extensions: a Tutorial and Reference (www.petebecker.com/tr1book)