Jump to content

array

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
3 replies to this topic

#1
kumamako

kumamako

    Newbie

  • Members
  • PipPip
  • 16 posts
hello guys. i am trying to do some question at the back of the chapter.

determine whether each of teh following is true or false. if false, explain why.

1) An array definition reserves space for an array.
2) To indicate that 100 locations should be reserved for integer array p, you write the declaration
p[ 100 ];
3) A for statement must be used to initialize the elements of a 15-element array to zero.
4) Nested for statements must be used to total the elements of a two-dimensional array.

the first one is true. correct me if iam wrong.

the third is false since you could initiaze during array declaration using initializer list. correct me if am wrong.

i am very much blank in the second and fourth. any suggestions?

#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
First, it depends on whether this is C or C++.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
kumamako

kumamako

    Newbie

  • Members
  • PipPip
  • 16 posts
c++

#4
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
You are correct on 1 and 3. Apply your logic for 3 to 4. The easiest way to test 2 is to try it with warnings on.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog