help need with arrays

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

Join Date: Feb 2008
Posts: 13
Reputation: heshangho is an unknown quantity at this point 
Solved Threads: 0
heshangho heshangho is offline Offline
Newbie Poster

help need with arrays

 
0
  #1
Mar 7th, 2008
hey guys

How do u define a 2by 5 array..is it mean

int t [2][5]..

how do u figure out how many elements in the array?
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,494
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1478
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: help need with arrays

 
0
  #2
Mar 7th, 2008
>>How do u define a 2by 5 array..is it mean
Yes you are right.

>>how do u figure out how many elements in the array?
first dimension times second dimenson. Very similar to a chess board where there are 8 rows and 8 columns, which means there are 64 squares. That's the same identical concept with 2d arrays. In your example 2 X 5 = 10 elments.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 13
Reputation: heshangho is an unknown quantity at this point 
Solved Threads: 0
heshangho heshangho is offline Offline
Newbie Poster

Re: help need with arrays

 
0
  #3
Mar 7th, 2008
Thanks man


So it means that it have 2 rows and 5 columns??

and do u know how to name the elements in a row.as a example in the second row

will it be like following?

t[1][0]
t[1][1]
t[1][2]
t[1][3]
t[1][4]
Reply With Quote Quick reply to this message  
Join Date: May 2006
Posts: 3,117
Reputation: WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of 
Solved Threads: 282
Moderator
WaltP's Avatar
WaltP WaltP is offline Offline
Posting Sensei

Re: help need with arrays

 
0
  #4
Mar 7th, 2008
Yes, again. Looks like you have it figured out.
The 3 Laws of the Procrastination Society:
1) Never do today that which can be put off until tomorrow
2) Tomorrow never comes
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 13
Reputation: heshangho is an unknown quantity at this point 
Solved Threads: 0
heshangho heshangho is offline Offline
Newbie Poster

Re: help need with arrays

 
0
  #5
Mar 7th, 2008
thnks dude
Reply With Quote Quick reply to this message  
Reply

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


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC