CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2011
    Posts
    153

    please help me with this small question about array

    Write an expression that accesses element 4 in subarray 2 in a two-dimensional array called twoD. The answer given in the book is: twoD[2][4].
    Is the answer correct? Shouldn't it be twoD[1][3] instead?

    Please let me know your opinion. Thanks.

  2. #2
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    10,895

    Re: please help me with this small question about array

    It's a subtle question which could be interpreted either way.

    If they were asking for the fourth element of the second subarray, you would be absolutely correct. Since they're identifying them by number, it is less clear what is intended.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured