Geeks Talk

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.

static array or dynamic array?

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 ?...

Go Back   Geeks Talk > Software Development > C and C++
Register Blogs FAQ Tag Cloud Calendar Mark Forums Read
  #1 (permalink)  
Old 06-21-2007
Junior Member
 
Join Date: Feb 2007
Posts: 15
Thanks: 2
Thanked 1 Time in 1 Post
rpgubba is on a distinguished road
Question static array or dynamic array?

How can you quickly find the number of elements stored in a
a) static array or in b) dynamic array ?
Reply With Quote
The Following User Says Thank You to rpgubba For This Useful Post:
Sponsored Links
  #2 (permalink)  
Old 06-21-2007
Junior Member
 
Join Date: Jun 2007
Location: salem
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts
Selvabalaji47 is on a distinguished road
Re: static array or dynamic array?

dynamic array
Reply With Quote
  #3 (permalink)  
Old 11-29-2007
Contributing Member
 
Join Date: Apr 2007
Location: Bangalore
Posts: 46
Thanks: 6
Thanked 8 Times in 7 Posts
prakash.kudrekar is on a distinguished road
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.
Reply With Quote
  #4 (permalink)  
Old 11-29-2007
Junior Member
 
Join Date: Nov 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
sonal_seema is on a distinguished road
Re: static array or dynamic array?

static array
Reply With Quote
  #5 (permalink)  
Old 12-20-2007
Contributing Member
 
Join Date: Nov 2007
Location: bangalore
Posts: 54
Thanks: 6
Thanked 6 Times in 4 Posts
rahulvegi is on a distinguished road
Re: static array or dynamic array?

dynamic array:

- if array has bulk elements then its efficient.

dynamic array is quick to find elements
Reply With Quote
  #6 (permalink)  
Old 12-22-2007
Contributing Member
 
Join Date: Dec 2007
Posts: 48
Thanks: 1
Thanked 8 Times in 7 Posts
sk_seeker is on a distinguished road
Re: static array or dynamic array?

Quote:
Originally Posted by rpgubba View Post
How can you quickly find the number of elements stored in a
a) static array or in b) dynamic array ?
Is this a trick question

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.
Reply With Quote
  #7 (permalink)  
Old 12-22-2007
Junior Member
 
Join Date: Dec 2007
Location: india
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
srinivasneeluri is on a distinguished road
Re: static array or dynamic array?

I dont know man dont disturb
Reply With Quote
Reply

  Geeks Talk > Software Development > C and C++

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


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


All times are GMT -4. The time now is 10:51 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.3.1
Copyright © 2009 GeekInterview.com. All Rights Reserved