the problem states: allocate an int in C++, initialize it to 7 and assign it to
a variable p1
print out the value of p1 and of the ints it
points to
Jacob Lund Fisker <[EMAIL PROTECTED]> wrote:
Not sure what you intend to do.
"new" allocates
"=" assigns
"int,double,float, ..." initializes.
So for instance ... int *i = new int(5);
new allocates space for an int on the heap, assigns the value 5 to that
space and returns the address which is assigned to a pointer called i
that is initialized to that address. Phew!
On Nov 13, 2007, at 6:41 PM, Robert Ryan wrote:
> allocate an int: int i =0;
> initialize an int: int i = 5;
> assign it to variable p1: p1 = 5;
>
> or is it this:
>
> int i =new int[ ];
> int p1[5];
> int* p1 = &p1[5];
>
> is this right
> bob ryan
>
>
> ---------------------------------
> Be a better sports nut! Let your teams follow you with Yahoo Mobile.
> Try it now.
>
> [Non-text portions of this message have been removed]
>
>
>
> To unsubscribe, send a blank message to
> <mailto:[EMAIL PROTECTED]>.
> Yahoo! Groups Links
>
>
>
---------------------------------
Be a better sports nut! Let your teams follow you with Yahoo Mobile. Try it now.
[Non-text portions of this message have been removed]