DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   C++ (http://www.daniweb.com/forums/forum8.html)
-   -   array numbers (http://www.daniweb.com/forums/thread158212.html)

666kennedy Nov 19th, 2008 1:15 am
array numbers
 
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

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

so each element is used would it be 0 to i < 16 or 0 to i < 15?

VernonDozier Nov 19th, 2008 1:40 am
Re: array numbers
 
Quote:

Originally Posted by 666kennedy (Post 739301)
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.


Quote:

Originally Posted by 666kennedy (Post 739301)
see if im using them in a loop

for instance

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

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.

Rashakil Fol Nov 19th, 2008 2:22 am
Re: array numbers
 
This is a stupid question. You should write small sample programs to verify your understanding of things like this.


All times are GMT -4. The time now is 11:46 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC