Tag Info

Hot answers tagged

81

Counting arrays from 0 simplifies the computation of the memory address of each element. If an array is stored at a given position in memory (it's called the address) the position of each element can be computed as element(n) = address + n * size_of_the_element If you consider the first element the first, the computation becomes element(n) = address + ...


37

While the principles below apply to decimal as well any other base, Counting from 0 in computers can be easily understood naturally from the fixed-digit binary system of representing numbers used in computers. If you have 8 bits, then there are 256 possible combinations of 1s and 0s that can be expressed. You could use these 8-bit to express the numbers ...


26

Never thought an opportunity for an armchair philosopher such as myself would come along on Superuser. There is a fundamental misconception at heart here, because non-philosophers tend to skip over the minute details. In short: Computers do not count from zero, but denomination of positions starts from zero. There is nothing confusing about this perceived ...


12

I think this has been covered before by "prof.dr. Edsger W. Dijkstra" - Burroughs Research Fellow in a letter dated 11 August 1982: c.f. EWD831 Titled: Why numbering should start at zero. "Are there reasons to prefer one convention to the other? Yes, there are...." Note also that Dijkstra was on the ALGOL 68 design team late until 1968. Algol68 permits ...


10

The distance analogy someone else brought up lends itself to a very practical illustration: "How far is your house from the nearest gas station?" "1 mile." "You live at the gas station?" "No, if I lived at the gas station it would be 0 miles" "Why are you counting from zero instead of from one?" Another good example would be birthdays - we don't say ...


8

The simple fact is that this is how many academic journals work. You might consider using your University library, many have both electronic and hardcopy journal subscriptions, and most decent ones will have systems like Lexis Nexis available. This sort of thing is a huge reason for Uni libraries in the modern age.


6

Your school will normally have a subscription to IEEE, Citeseer, Google Scholar, ACM and the various research paper controlled resources. You might have to use the computers on campus to access the information. Check with your libraries or your department administrators. They normally do not just make the information open to all because of cost involved ...


6

As already said by others computers do not count from zero. Some languages index from 0. Indexing from 0 has two main advantages: It converts to assembly in a natural fashion because it can be interpreted as an offset from a pointer to the first position. You don't get weirdness when you want negatives. How many years between 1BC and 1AD? None. Because ...


3

Not sure if this question is on-topic, but it's interesting so... I have delivered training courses to similar groups and would suggest: Computer Maintenance (Correctly installing programs, cleaning your system etc) Beginning Google Search (How to use advanced search techniques) Social Media Starter Guide (If you want to go down this road) Basic ...


3

As far as I've seen, computer science is software (applications, operating systems, etc.) and computer engineering is hardware (CPUs, circuit boards, etc.). Computer science is what I did.


3

Counting naturally begins at zero Here is the algorithm for counting apples in a basket: count := 0 for each apple in basket count := count + 1 After the execution of the above, count holds the number of apples. It may be zero, because baskets can be empty. If you don't use your credit card for an entire month, do you get a bill of 1 dollar? Or 1 ...


2

Starting at zero is practical when describing a distance from something. So in this array: [4,9,25,49] the distance from the start of the array to the 25 is 2 - you need to skip two steps to get there. The distance to the 4 is zero - you don't need to move from the start at all. It's practical to think like this when adding up distances (or indexes) - I ...


2

If your are talking about an "extension" it is in the name of the file. However, this information is used by the OS to launch a certain application. For example, Safari/Chrome/Firefox for files ending in .html. The application then uses the header(first few bytes) of the file to see if can display it. It may also interpret it in a way that outputs junk ...


2

This may be less efficient than what you'd prefer, but if you find a paper that you don't have access to, first: Look up the author's website and see if they provide a PDF to download. This is especially common in CS Contact the corresponding author (or just the first author if it's not clear) and ask if they will send you a copy. They are almost always ...


2

I'm assuming by "LCD Inverter" you mean some sort of converter to connect the LCD's data ribbon cable to a VGA port. If you mean the real inverter, which is a small, flat PCB involved in powering the LCD, you should examine closely the one in your AIO now and try to find the exact same model or compatible on Ebay. If you mean the LCD display, all I can ...


2

Arbitrary precision is possible in scientific computing. You just pay for it in additional processing. It is the responsibility of the the scientist to be aware of computational limitations in their calculations and to test for them. For example, small changes in input parameters should produce correspondingly small changes in the output. Arbitrary ...


1

If I recall correctly from my Programming Language Concepts class... languages being 0-indexed and others being 1-index had to do with historical reasons. Algol-68, the grand-daddy of programming languages was actually 1-indexed, as well as Fortran and a few other "business" languages like COBOL. In some of these languages however, you could actually specify ...


1

Number 0 could denote various meaning: numeric value, ordinal, memory address, etc. 'Index zero' doesn't means programmers count from zero. It denote the first place of an allocated memory block and '0' is the address of it. In C, looping through an array could be written as below: int arr[N]; for (i=0; arr[N]; ++i) { ... } Same work can be done in C#: ...


1

Remember how numbers are represented in a computer. Let's take a byte variable. 0 is represented as 000000001 in binary. 1 is 00000001. 2 is 00000010. And so on. Note that the lowest number that a byte can store is 0. If we started array indices with 1, then the system would be inefficient, since we now have an array of length 255 instead of 256. Since ...


1

Modulo One thing the existing good answers don't mention yet: zero-based indexing works well together with modulo operations, which can therefore be combined to form cyclic list. Think for example about something like color = colors[i % colors.length] which might give each object (indexed by i) a different color from the list colors, until all colors ...



Only top voted, non community-wiki answers of a minimum length are eligible