array numbers

Please support our C++ advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Mar 2008
Posts: 63
Reputation: 666kennedy is an unknown quantity at this point 
Solved Threads: 0
666kennedy 666kennedy is offline Offline
Junior Poster in Training

array numbers

 
0
  #1
Nov 19th, 2008
i have an array

weights[16][60]

16 rows of 60 columns

if you are changing indiviual elements it goes from weights[0][0] to weights[15][59] right?

see if im using them in a loop

for instance

  1. ]for(int i = 0; i < 16; i++)
  2. {

so each element is used would it be 0 to i < 16 or 0 to i < 15?
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 3,844
Reputation: VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute 
Solved Threads: 503
Featured Poster
VernonDozier VernonDozier is offline Offline
Senior Poster

Re: array numbers

 
0
  #2
Nov 19th, 2008
Originally Posted by 666kennedy View Post
i have an array

weights[16][60]

16 rows of 60 columns

if you are changing indiviual elements it goes from weights[0][0] to weights[15][59] right?
Correct.


Originally Posted by 666kennedy View Post
see if im using them in a loop

for instance

  1. ]for(int i = 0; i < 16; i++)
  2. {

so each element is used would it be 0 to i < 16 or 0 to i < 15?
i < 16 . You want to include 15. If it was i < 15 , that would only go up to 14.
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 2,055
Reputation: Rashakil Fol is just really nice Rashakil Fol is just really nice Rashakil Fol is just really nice Rashakil Fol is just really nice 
Solved Threads: 139
Team Colleague
Rashakil Fol's Avatar
Rashakil Fol Rashakil Fol is offline Offline
Super Senior Demiposter

Re: array numbers

 
1
  #3
Nov 19th, 2008
This is a stupid question. You should write small sample programs to verify your understanding of things like this.
All my posts may be redistributed under the GNU Free Documentation License.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 262 | Replies: 2
Thread Tools Search this Thread



Tag cloud for C++
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC