Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


Why Array Index starts from Zero

Answers were Sorted based on User's Feedback



Why Array Index starts from Zero..

Answer / manu

he compiler thinks that 0 is a positive number.
we have an integer range of
-128 to 127.
here -128 to -1 are negative numbers
and 0 to 127 are positive numbers
so array starts with the 0 as index.

Is This Answer Correct ?    0 Yes 0 No

Why Array Index starts from Zero..

Answer / rajesh bansal

This boils down to the concept of Binary digits. Take an
array size of 64 for example. We start from 0 and end at 63.
We require 6 bits.But, if we were to start from 1 and end at
64, we would require 7 bits to store the same number, thus
increasing the storage size......
For more details please check out this link...

http://www.mindstick.com/Interview/1100/Why%20Array%20Index%20starts%20from%20Zero

Thanks Everyone!!

Is This Answer Correct ?    0 Yes 0 No

Why Array Index starts from Zero..

Answer / kamal

I think ther is need to give specific ans all the answer
looks complimentoy..

Is This Answer Correct ?    0 Yes 0 No

Why Array Index starts from Zero..

Answer / maragatham

because arrays are pointers and you are giving offsets from the base pointer

Is This Answer Correct ?    0 Yes 0 No

Why Array Index starts from Zero..

Answer / rahul sharma

Dijkstra explains why we should index from 0. This is a
problem on how to denote a subsequence of natural numbers,
say for example 1,2,3,...,10. We have four solutions available:
a. 0<i<11
b. 1<=i<11
c. 0<i<=10
d. 1<=i<=10

Dijkstra argues that the proper notation should be able to
denote naturally the two following cases:
1. The subsequence includes the smallest natural number, 0
2. The subsequence is empty

Requirement 1. leaves out a. and c. since they would have
the form -1<i which uses a number not lying in the natural
number set (Dijkstra says this is ugly). So we are left with
b. and d. Now requirement 2. leaves out d. since for a set
including 0 that is shrunk to the empty one, d. takes the
form 0<=i<=-1, which is a little...well, messed up!
Subtracting the ranges in b. we also get the sequence
length, which is another plus. Hence we are left with b.
which is by far the most widely used notation in programming
now.

Is This Answer Correct ?    0 Yes 0 No

Why Array Index starts from Zero..

Answer / lovely pal

i think array size [a+i] and [a+0] it is are both not possible beause if we add the any int in {a+i} ex-:i=1 and value is increse not possible at 0 state how can be possible[a+i] and[a+0].

Is This Answer Correct ?    0 Yes 0 No

Why Array Index starts from Zero..

Answer / vishal kumar jaiswal

array name gives base address means internally it is pointer and also due to mapping concept like
arr[0]=
=*(arr+0)
=(500+0) // 500 is a base address
=*(500)
it gives first element otherwise it gives next element

Is This Answer Correct ?    1 Yes 1 No

Why Array Index starts from Zero..

Answer / vidhisha

 There are many reason for base indexing 0
The 1st  and 2 nd ans is correct but I have an another reason for that
Array a[n] means how far its n element away from the starting 
So a[0] is 0 element away from first element so set base indexing 0

Is This Answer Correct ?    0 Yes 0 No

Why Array Index starts from Zero..

Answer / krishnabhargav

This boils down to the concept of Binary digits. Take an
array size of 64 for example. We start from 0 and end at
63. We require 6 bits.But, if we were to start from 1 and
end at 64, we would require 7 bits to store the same
number, thus increasing the storage size.

Is This Answer Correct ?    12 Yes 13 No

Why Array Index starts from Zero..

Answer / kinshuk

All Answers are wrong. There are many programming languages
where array index starts from 1. Its all compiler specific
like Pascal

Is This Answer Correct ?    13 Yes 14 No

Post New Answer

More MFC Interview Questions

What is a critical section and how is it implemented?

2 Answers  


how u can move CDC pointer to one line in cview?

2 Answers  


If there is more than 100 control in a window how we can change the Taborder of a controls

4 Answers   Satyam,


What is the command routing in MFC framework?

3 Answers  


if both base and derived class have the constructors if i create an object for derive class which class constructor is executed first

10 Answers   Siemens, Symphony,


What is userdefine Messages in MFC?

1 Answers   HCL,


Given two processes, how can they share memory?

2 Answers   Microsoft,


What is the range of intensity of RGB

1 Answers  


What is LPCTSTR? What does LP denote it?

4 Answers  


What is CALLBACK? How it work? what is the advantage of CALLBACK, please explain with an example

6 Answers  


WHAT IS DIFFERENT BETWEN RELEASE MODE & DEBUGGING MODE

4 Answers   Google, Microsoft, TCS,


What are the types of button controls?

10 Answers  


Categories