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 / pooja sonawane

the index of array, which is of the form a[i], is converted
by the compiler in the form [a+i]. So, the index of first
element is zero because [a+0] will give 'a' & the first
array element can be accessed. Due to this, we can also
access the array elements as'i[a]' instead of 'a[i]' , &
this will not produce an error.

Is This Answer Correct ?    183 Yes 48 No

Why Array Index starts from Zero..

Answer / chandan singh from niit

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 ?    111 Yes 77 No

Why Array Index starts from Zero..

Answer / rck

The complier treats a[0] as *(a+0) ie *(a+0) (array name is
the base address of that array)gives the first element of
the array.
If the array starts from 1 a[1] is treated as *(a+1) gives
the second element of array.The first element is missing.so
array always starts from 0.

Is This Answer Correct ?    35 Yes 14 No

Why Array Index starts from Zero..

Answer / ashish verma

The index of array, which is of the form a[i], is converted
by the compiler in the form [a+i]. So, the index of first
element is zero because [a+0] will give 'a' & the first
array element can be accessed. Due to this, we can also
access the array elements as'i[a]' instead of 'a[i]' , &
this will not produce an error.

Is This Answer Correct ?    18 Yes 13 No

Why Array Index starts from Zero..

Answer / ranga raj.b

Array is a chunk of continues memory allocation. The arthmetic that is used by compiler to move to the next array location is StartAddress + (Index)*sizeof(int)if it is an integer array.now if we see to access the first location of the array we have to give Index =0 and for next location index =1 and so on...This is why array index start with zero.

Is This Answer Correct ?    6 Yes 1 No

Why Array Index starts from Zero..

Answer / chetan

Both Answer ARE correct but First one is EXACT and after
that compiler is design according to that

Is This Answer Correct ?    24 Yes 20 No

Why Array Index starts from Zero..

Answer / ashlesha

Second answer is correct. but its compiler specific to start an array index with 1 or zero.as in pascal the array index starts with '1'.

Is This Answer Correct ?    5 Yes 3 No

Why Array Index starts from Zero..

Answer / vikas chand

yes first ans is exactly correct.
second one is wrong because in java, c# etc array index is
start with zero..
but in that case we can not write a[i] as i[a]...
because a is reference variable...
so i think first ans is exactly right......

Is This Answer Correct ?    4 Yes 2 No

Why Array Index starts from Zero..

Answer / sabab ali khan

becouse the value of given index are multiplied by size of
datatype of array and then add in the base Address to find
address of that block which you want to access
ex.
int arr[5];
if the base address of array is 1001 then last block
address will be 1009
and if we give arr[2] then compiler calculate address like
this..
1001 + sizeof(int)* 2 = 1005
where base address = 1001
and 2 is the given index.
so the calculated address is 1005 and third block will be
access.

Is This Answer Correct ?    7 Yes 5 No

Why Array Index starts from Zero..

Answer / v .saikiran

I Think second one correct

Is This Answer Correct ?    5 Yes 4 No

Post New Answer

More MFC Interview Questions

Psychic Window Technique

2 Answers   E Logic, Wild Net,


how to give colour for dialog button or static buuto?any one explain full code ?pls pls

3 Answers  


1)How to change the size of a button at run time ?

1 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,


I have 2 threads. One thread prints odd numbers and the second thread prints even numbers. Now, I have to execute the threads alternatively so that i can output 1,2,3,4,5,6,..... write code for this?

1 Answers  


I can i set size of integer variable should be fixed for different operating systems(Ex i want integer size is 2bytes in OS)

2 Answers   Invensys,


What is socket?

3 Answers  


What is Thread ?(VC++)What is the difference between Cmutex and Csemaphone?

5 Answers   Atos Origin,


How to handle dynamic menus in mfc? What happens when client calls cocreateinstance?

0 Answers  


1)dynamic creation of a Button ?

2 Answers   TCS,


what if we provide two message handler for same message ?

1 Answers  


what are the feauters of CObject

4 Answers   Siemens, Wipro,


Categories