Why Array Index starts from Zero
Answers were Sorted based on User's Feedback
Answer / karthiga
In os the memory location starts with 0 only.Consider, if
we try to store the value at 1st location means we cant use
our os memory efficiently.That's why all the data type's
memory size are in even numbers.
Is This Answer Correct ? | 2 Yes | 3 No |
Answer / digvijay mishra
I think it dosen,t contain any appropriate answer. If i
will find the appropriate one then i post
it.................
Is This Answer Correct ? | 2 Yes | 3 No |
Answer / priyanka
I think it is just a programming convention nothing more than that otherwise in c array index starts from 1 and can be compiled from the same compiler with which C
++ program can be.
Is This Answer Correct ? | 1 Yes | 2 No |
Answer / sandeep
array start with zero index ,it have two main reason.
1>when we allocate a memory first element always store the
address .then u are able to communicate with next address.
example:a[i] put i=0,then it show the address ..
Is This Answer Correct ? | 2 Yes | 3 No |
Answer / mohit
There are many language have array index is starting with
zero and one. The main reason of starting of array is index
is dynamically allocation of array size. Those language
follow the concept of array index is zero have dyanamicaly
allocation of memory and on the other hand starting with one
only have concept of staticlly allocaton.
Is This Answer Correct ? | 0 Yes | 1 No |
Answer / san
Yes, first one is absolutely correct because before going
to array size we have to analyze the register settings.
Is This Answer Correct ? | 11 Yes | 15 No |
Answer / guru
Simple answer, 0 is the starting number of natural numbers.
Be +ve always.. So no one will like to use -ve numbers more than the positive numbers.
You may thing above answer is wrong but the designer will consider above things in mind and creates the compiler.
Thanks,
GP
Is This Answer Correct ? | 0 Yes | 6 No |
Answer / murukesan
i think 2nd answer is correct
'we can also
access the array elements as'i[a]' instead of 'a[i]' , &
this will not produce an error' is wrong
Is This Answer Correct ? | 14 Yes | 37 No |
What is the initial function to be called in MFC and what it will do
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?
is it possible to display a window .without using windowclass
How to setup a timer?
1)how to Display the File Dialog Box, in MFC ?
if no message handler is available for a message then will deal with the message ? does window proving any default mechanism?
what is the meaning of constant FILE EXCEEDS LENGTH LIMIT while loading from ps file to vsam in the jcl?
If application hangs while SendMessage is waiting for the result, how you handle it?
What is stack size in win32 program?
What is Multithreading
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.
1) Enable or disable a Cancel button at run time?