How to get length of array?

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

Join Date: Jul 2007
Posts: 77
Reputation: ivatanako is an unknown quantity at this point 
Solved Threads: 5
ivatanako ivatanako is offline Offline
Junior Poster in Training

Re: How to get length of array?

 
0
  #11
Sep 12th, 2009
How do you make an array dynamically expandable?
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 1,973
Reputation: tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute 
Solved Threads: 214
tux4life's Avatar
tux4life tux4life is offline Offline
Posting Virtuoso

Re: How to get length of array?

 
1
  #12
Sep 12th, 2009
Originally Posted by ivatanako View Post
How do you make an array dynamically expandable?
Using a 'normal' array this isn't possible in C, you could maybe try your hands on a linked list?
"Never argue with idiots, they just drag you down to their level and then beat you with experience."
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 5,850
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 751
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: How to get length of array?

 
0
  #13
Sep 12th, 2009
The array sizeof thing only works when the definition of the array is in scope - that is, the compiler can see the actual array.

An array declaration, say
extern int array[ ];
or an array parameter
void foo ( int array[ ] );
needs a different approach.
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: 1037 | Replies: 12
Thread Tools Search this Thread



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

©2003 - 2009 DaniWeb® LLC