Okay this sounds like a question a six year old would ask, (and I hope there is an empirical answer) so here's my inner child: In programming numbers start from from zero but why do line numbers in text editors (for programming) also start from one?
Line numbers need to be countable. It is more intuitive to start counting at
1 instead of
0 (say: zero) means none, not one.
Looking at a coffee mug on your table, you would not answer the question of how many mugs there are by saying: "Zero" - because that would imply no mug at all is on your table. Thus with line numbers, and almost every other countable thing there is, you'd start with
1 for logic reasons.
Your real questions should be: Why on earth do array indices and the like start from
0 in programming! :)
Kontur is correct. But I would also like the add that Arrays in programming start at 0 for a very specific reason. This is not because the number in an array is supposed to 'count' the amount of elements, but instead it is considered an offset value, and thus array merely means that the specific entry is 0 memory positions away from the start of the array in memory and array is 1 position along. They are not used for counting purposes but as an offset meaning it is perfectly logical that programming lists start at 0.
Early languages like FORTRAN had the first element of an array starting with 1, and it was weird when C came along to use 0. That's only natural to you youngsters. FORTRAN started with 1 because it was natural to number things in a list starting with 1. C started with 0 because it was a language deliberately written to be close to the hardware, whereas FORTRAN was abstracting the mathematical concepts with no idea as to how the computer would implement it. Of course we had to be able to know in some cases how the code was implemented in machine language, but in general C is much closer to the hardware.
It is purely historical / traditional / cultural. In many ways one can argue that line numbers should start at zero. But text editors have always labeled the first line as line one, and any editor that labeled it as zero would be outcast.
Generally, the difference between starting at 1 and starting at zero is whether you are "counting" or "measuring". If you measure a highway, it is clear that the point where the highway starts is "zero". But what do you call that first mile? Is it "mile 0" or is it the "first mile"? Both are acceptable depending upon whether you are measuring the distance, or counting the miles. This is very much like centuries: 1950 is the middle of the "20th century". The distinction is the 1950 is a measure of the time since the beginning (except there was no year zero, another historical anomaly) and the other is a counting of the centuries.
In an array, we are "measuring" to the position, and this is preferred not because it is closer to the hardware, but because the math works out easier. The first element in an array is always 0 units from the beginning of the array. This becomes quite apparent when you have an array of arrays. Imagine an array of decades, each element of which is an array of years. You would want the years to run 0 thru 9 to represent a decade like 1950 thru 1959. While it could be implemented either way (the first year of the decade is 1950, which is zero years from the start of the decade). The math is easier if the you can simply subtract to find the offset = (year - decade_start).
All that being said, the logic is that the first line of a text file really should be called "line 0" because you are measuring the position in the text file. But it is not. I don't believe there is a logical reason for that, but simply that it has been traditionally labeled with a "1". Perhaps in the same tradition that the first year in the Gregorian calendar is named "1" as well.