declaration int *arr;

Assume the declaration int *arr;

Which declaration dynamically creates an array of 35 integers? Circle one.

(a) arr = new int[35];
(b) *arr = int[35];
(c) arr = new int(35);
(d) *arr = new[35] of int;


answer is a..

because ..

first we did a pointer int *arrr

now is asking us which one creates an array of 35 intergers from 0-34

therefore the answer is a,

not c because (35) gives us a value of 35 in the heap.

is this correct?
Topic archived. No new replies allowed.