Build your professional network on facebook via our app Go to app
 
 
 
Activity: Question posted: 09 13 2011 07:56:22 +0000, 2 answers, 73 views, last activity 09 14 2011 08:33:01 +0000
 
 Refer 114
Share
 
 
  Rate : 
 
 

Why the array size in programming language start with 0 and not with 1 or any other number. what will be if it will start from any other number?

 
  Answered by     Nitin Mehra, Software Developer, ROBOMAN MICROSYSTEMS  | 09 14 2011 08:33:01 +0000
[ Delete ]
[ Edit ]
Not Rated

Dear Issac

I think this is not in the way you are putting in. This is not the matter of compiler. you can see that every language use the starting of array with 0. also in the theory we use the array start with 0 where no computer is there.  programming languages like c, c++ , java, C# or even in .net array start with 0. There will be some logic behind this. i think you should try to find out that. programming languages and also compiler are made by human. and there must be some logic behind this. please try to find out i am sure you will be succeed.

  Answer modified by     Isaac Madhavan, IT / Technical Writer, IT major  | 09 13 2011 17:34:46 +0000
[ Delete ]
[ Edit ]
Not Rated

Profound question.

Well, to put it simply, this question is like asking why "one" is called "one" and not "two". Which is also profound. 

The answer? That was the way it is generally set by the designer of the COMPILER of the programming language. What I think is that since zero is a number as well, we can start with that. 

In XML though, when you want to access nodes, the specification says that those who implement XML processors (like those built into IE, Firefox, Chrome, etc) should start the numbering of nodes from "1". 

However, MS chose to implement the index of the first node as zero and NOT one.

So, I hope you can see that there is no logic, it is just a matter of choice.

As to what will happen if it starts with any other number... nothing! All we have to do is know the starting index number and we can take it from there. 

 
Rate:
Submit
Post Your Resume Now !
urgent jobs in Risk Analytics Mumbai
urgent Risk Analytics job Mumbai
urgent Risk Analytics opening Mumbai
Viewers also viewed
AS BOTH VLSI EMBEDDED ARE CHIP DESIGN LEVEL PROGRAMMING WHICH ONE IS BETTER? MEANS WHICH HAVING...
 
1 referals 9 arguments, 5269 views
In a surprising news, recently the Gujarat High Court dismissed the claim by the petitioner that...
 
475 referals 151 arguments, 4651 views
more...  
Unanswered Questions (69)
I have to work out cost for a project happening in stages, i have calculated it for current...
 
0 referals 0 answers, 0 views
How Indian companies going to adopt this new technology.How cloud computing application going to...
 
0 referals 0 answers, 0 views
Consider the implication of this idea... What would happen if you were to be followed by a...
 
201 referals 1 answers, 20 views
More From Author
There is only two side so i am posting in this column but in true i am not supporting both of these two. world is of open computing in next days perl, python, php andriod and more... if you really want to go ahead just switch to open souce tools...
This is the matter of individual person almost all website like facebook provide the necessary privacy control but who is using that control depends upon the wish and computer knowledge of that person. if people really care about their privacy they...
more...