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

Which MFC function is used to display output?

9 Answers   TCS,


Does the application have more than one object? If Yes, Briefly explain.

2 Answers   Soltius Infotech,


what is the use of CWinApp class?

3 Answers   Mphasis,


1.Get string1,string2,string3 1.add string1 and 2,string1 and 3. 2.replace vowels with T 3.count number of T. 4.remove T 5.COPY string1 to stringf. 6.restore string1. print the following 1.Number of T 2.StringF 3.string1+string2+string3 Use pointers and functions

1 Answers  


how many types of messages are their

4 Answers   E Logic, TCS,


What is the difference between GetMessage and PeekMessage ?

3 Answers  


what is message loop how mfc does it internally?

4 Answers   Aspire,


Q1. A. What is unary operator? List out the different operators involved in the unary operator. B. What is an adjust field format flag? Q2. A. Distinguish between a # include and #define. B. Can a list of string be stored within a two dimensional array? Q3. A. Explain how a pointer to function can be declared in C++? B. List the merits and demerits of declaring a nested class in C++? Q4. A. What are the syntactic rules to be avoid ambiguity in multiple inheritence? B. Explain the operation of overloading of an assignment operator. Q5. A. Explain how the virtual base class is different from the conventional base classes of the opps. B. Explain how an exception handler is defined and invoked in a Program. Q6. A. What is a binary file? List the merits and demerits of the binary file usagein C++. B. Write short notes on Text Manipulation Routines. C. Write bites in Turbo c++ Header ("Include") Files.

3 Answers   ABC, HCL, Infosys,


1) Enable or disable a Cancel button at run time?

1 Answers   HCL,


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,


In SDI how many view's are attached to document object and in MDI how many view's are attached to Document object?

2 Answers   Wipro,


How we call a dialog in another dialog?

2 Answers  


Categories