Prepare for your Next Interview
|
Welcome to the Geeks Talk forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
This is a discussion on static array or dynamic array? within the C and C++ forums, part of the Software Development category; How can you quickly find the number of elements stored in a a) static array or in b) dynamic array ?...
|
|||||||
|
|||
|
How can you quickly find the number of elements stored in a
a) static array or in b) dynamic array ? |
| The Following User Says Thank You to rpgubba For This Useful Post: | ||
| Sponsored Links |
|
|||
|
Re: static array or dynamic array?
static array
----------- static array access would be more faster. Since its the index move. And the static array space is allocated at stack. ex: a[4]={'1','2','3','4'} for(i=0;i<4;i++) { printf("%d",a[i]); } Since its the index jump this would be faster. Dynamic array -------------- Dynamic array would be slow since its pointer(address) increment. |
|
|||
|
Re: static array or dynamic array?
Quote:
![]() First of all, you need to specify the language where you want this answer. 2. Lets assume you are programming in C. Then, there is no way one can find the number of elements stored in a static array. If there is way, I would like to know how it is done. 3. One might only find the maximum no of elements in an array if there is a special value entered programatically that indicates that we have reached the end of the array. |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Dynamic and Static lookup | JobHelper | Data Warehousing | 3 | 02-08-2008 10:38 PM |
| Help on Dynamic Array | nancyphilips | C and C++ | 8 | 12-25-2007 09:59 AM |
| convert one dimansional array to two dimansional array | Geek_Guest | C and C++ | 6 | 12-22-2007 04:17 AM |
| difference between static and dynamic testing? | sakshi_2801 | Testing Issues | 1 | 02-19-2007 01:27 AM |
| cursor to array. | Barbie | Oracle | 1 | 02-06-2007 08:57 AM |