TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: William McBrine
from: Neil Heller
date: 2003-08-03 10:39:04
subject: Re: This always drives m

NH> 1)  int * pIntArray = new int[100];
NH> 2)  int IntArray[100];

NH> If I wanted to place a value, say 1000, in the 7th position of
NH> #2, I would go IntArray[7] = 1000.

NH> If I wanted to place the same value in the same position of #1,
NH> how would I go about doing it?

WM> Same way:

WM>  pIntArray[7] = 1000;

WM> Think of both "IntArray" and "pIntArray" as
pointers. So when you
WM> say:

What _really_ confused me was the thought that since

     int IntArray[100];

is a pointer to 100 consecutive integers,

     int * pIntArray = new int[100];

must be a pointer to a pointer to 100 consecutive integers.

Bzzzzt.  Wrong!

That you for the explanation.

þ CMPQwk 1.42 999

--- Maximus/2 3.01
* Origin: COMM Port OS/2 juge.com 204.89.247.1 (281) 980-9671 (1:106/2000)
SEEN-BY: 633/267 270
@PATH: 106/2000 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.