Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Stephens' C# Programming with Visual Studio 2010 24-Hour Trainer
This is the forum to discuss the Wrox book Stephens' C# Programming with Visual Studio 2010 24-Hour Trainer by Rod Stephens; ISBN: 9780470596906
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Stephens' C# Programming with Visual Studio 2010 24-Hour Trainer section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 11th, 2013, 04:47 PM
Authorized User
Points: 179, Level: 3
Points: 179, Level: 3 Points: 179, Level: 3 Points: 179, Level: 3
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2013
Posts: 41
Thanks: 0
Thanked 0 Times in 0 Posts
Default Multi-Dimensional Arrays, pg.198

I thought I understood arrays until I read your example on pg. 198.

It's a four by eight array, so why wouldn't it be:

int[ , ] values = new int[4, 8];

values[0, 0] = 0 * 0;
...
values[3, 7] = 3 * 7;


that is, the array is initialized to 4 x 8 (4 rows, 8 columns) not [5, 7] as shown in the text, and

the last "box" is values[3, 7] not values[4, 7] as in the text.

and the last box holds the results of 3 * 7, not 4 * 7 ...
  #2 (permalink)  
Old June 11th, 2013, 08:36 PM
Rod Stephens's Avatar
Wrox Author
Points: 3,166, Level: 23
Points: 3,166, Level: 23 Points: 3,166, Level: 23 Points: 3,166, Level: 23
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2006
Location: , , .
Posts: 647
Thanks: 2
Thanked 96 Times in 95 Posts
Default

There's a typo in that code. It was reported but I don't know if it made it to the errata page. The array should be created as:

Code:
new int[5, 7]
It then has rows 0 through 4 and columns 0 through 7.

You're right that the one in the picture would be declared new int[4, 8].
__________________
Rod

Rod Stephens, Microsoft MVP

Essential Algorithms: A Practical Approach to Computer Algorithms

(Please post reviews at Amazon or wherever you shop!)
  #3 (permalink)  
Old June 12th, 2013, 01:10 PM
Authorized User
Points: 179, Level: 3
Points: 179, Level: 3 Points: 179, Level: 3 Points: 179, Level: 3
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2013
Posts: 41
Thanks: 0
Thanked 0 Times in 0 Posts
Default

If it was int[5,7]

would it not have

rows 0 through 4 and columns 0 through 6,( not 0 through 7) ??.
  #4 (permalink)  
Old June 12th, 2013, 01:59 PM
Rod Stephens's Avatar
Wrox Author
Points: 3,166, Level: 23
Points: 3,166, Level: 23 Points: 3,166, Level: 23 Points: 3,166, Level: 23
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2006
Location: , , .
Posts: 647
Thanks: 2
Thanked 96 Times in 95 Posts
Default

Yes, you're right.
__________________
Rod

Rod Stephens, Microsoft MVP

Essential Algorithms: A Practical Approach to Computer Algorithms

(Please post reviews at Amazon or wherever you shop!)
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
plotting 2 different 1 dimensional arrays versus each other sanderson Visual Basic 2008 Essentials 3 February 13th, 2009 08:00 AM
Plotting 2 1-dimensional arrays sanderson Visual Basic 2008 Essentials 0 January 15th, 2009 05:29 PM
muti dimensional arrays help:( chris1012 Java Basics 6 December 22nd, 2007 01:11 PM
1 and 2 dimensional arrays jeff_cafm VB.NET 2002/2003 Basics 1 April 26th, 2006 05:02 PM
1 and 2 dimensional arrays jeff_cafm VB.NET 1 April 24th, 2006 03:05 PM



All times are GMT -4. The time now is 04:05 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.