Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
0
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Computer science== Modern computers store information in [[Binary code|binary]], that is, using an "alphabet" that contains only two symbols, usually chosen to be "0" and "1". Binary coding is convenient for [[digital electronics]], where "0" and "1" can stand for the absence or presence of electrical current in a wire.{{sfn|Woodford|2006|p=9}} [[Computer programming|Computer programmers]] typically use [[high-level programming language]]s that are more intelligible to humans than the [[machine code|binary instructions]] that are directly executed by the [[central processing unit]]. 0 plays various important roles in high-level languages. For example, a [[Boolean data type|Boolean variable]] stores a value that is either ''true'' or ''false,'' and 0 is often the numerical representation of ''false.''{{sfn|Hill|2020|p=20}} 0 also plays a role in [[Array (data type)|array]] indexing. The most common practice throughout human history has been to start counting at one, and this is the practice in early classic programming languages such as [[Fortran]] and [[COBOL]].<ref>{{Cite book |last=Overland |first=Brian |url=https://books.google.com/books?id=bW6MiHxPULUC&dq=cobol+array+index&pg=PT132 |title=C++ Without Fear: A Beginner's Guide That Makes You Feel Smart |date=2004-09-14 |publisher=Pearson Education |isbn=978-0-7686-8488-9 |pages=132 |language=en}}</ref> However, in the late 1950s [[LISP]] introduced [[zero-based numbering]] for arrays while [[Algol 58]] introduced completely flexible basing for array subscripts (allowing any positive, negative, or zero integer as base for array subscripts), and most subsequent programming languages adopted one or other of these positions.{{Citation needed|date=June 2024}} For example, the elements of an array are numbered starting from 0 in [[C (computer language)|C]], so that for an array of ''n'' items the sequence of array indices runs from 0 to {{nowrap|''n''β1}}.<ref>{{Cite book |last1=Oliveira |first1=Suely |url=https://books.google.com/books?id=E6a8oZOS8noC&dq=C+array+index+zero&pg=PA64 |title=Writing Scientific Software: A Guide to Good Style |last2=Stewart |first2=David E. |date=2006-09-07 |publisher=Cambridge University Press |isbn=978-1-139-45862-7 |pages=64 |language=en}}</ref> There can be confusion between 0- and 1-based indexing; for example, Java's [[JDBC]] indexes parameters from 1 although [[Java (programming language)|Java]] itself uses 0-based indexing.<ref>{{Cite web |title=ResultSet (Java Platform SE 8 ) |url=https://docs.oracle.com/javase/8/docs/api/java/sql/ResultSet.html |access-date=2022-05-09 |website=docs.oracle.com |archive-date=9 May 2022 |archive-url=https://web.archive.org/web/20220509185749/https://docs.oracle.com/javase/8/docs/api/java/sql/ResultSet.html |url-status=live }}</ref> In C, a [[byte]] containing the value 0 serves to indicate where a [[String (computer science)|string]] of characters ends. Also, 0 is a standard way to refer to a [[null pointer]] in code.<ref>{{cite book|last=Reese |first=Richard M. |title=Understanding and Using C Pointers: Core Techniques for Memory Management |year=2013 |isbn=978-1-449-34455-9 |publisher=O'Reilly Media |url=https://books.google.com/books?id=-U155tRMLJgC&dq=C%20%22null%20pointer%22%200&pg=PT26}}</ref> In databases, it is possible for a field not to have a value. It is then said to have a [[null (SQL)|null value]].<ref>{{Cite book |last1=Wu |first1=X. |url=https://books.google.com/books?id=SdLsCgAAQBAJ&q=%C2%A0In+databases%2C+it+is+possible+for+a+field+not+to+have+a+value+%28null%29&pg=PT197 |title=Knowledge-Base Assisted Database Retrieval Systems |last2=Ichikawa |first2=T. |last3=Cercone |first3=N. |date=25 October 1996 |publisher=World Scientific |isbn=978-981-4501-75-0 |language=en |access-date=7 November 2020 |archive-date=31 March 2022 |archive-url=https://web.archive.org/web/20220331032618/https://books.google.com/books?id=SdLsCgAAQBAJ&q=%C2%A0In+databases%2C+it+is+possible+for+a+field+not+to+have+a+value+%28null%29&pg=PT197 |url-status=live }}</ref> For numeric fields it is not the value zero. For text fields this is not blank nor the empty string. The presence of null values leads to [[Ternary logic|three-valued logic]]. No longer is a condition either ''true'' or ''false'', but it can be ''undetermined''. Any computation including a null value delivers a null result.<ref>{{cite web |url= https://www.ibm.com/docs/en/rbd/9.5.1?topic=parts-null-values-nullable-type |title= Null values and the nullable type |author= <!--Not stated--> |date= 12 December 2018 |website= IBM |access-date= 23 November 2021 |quote= In regard to services, sending a null value as an argument in a remote service call means that no data is sent. Because the receiving parameter is nullable, the receiving function creates a new, uninitialized value for the missing data then passes it to the requested service function. |archive-date= 23 November 2021 |archive-url= https://web.archive.org/web/20211123185142/https://www.ibm.com/docs/en/rbd/9.5.1?topic=parts-null-values-nullable-type |url-status= live }}</ref> In mathematics, there is no "positive zero" or "negative zero" distinct from zero; both β0 and +0 represent exactly the same number. However, in some computer hardware [[signed number representations]], zero has two distinct representations, a positive one grouped with the positive numbers and a negative one grouped with the negatives. This kind of dual representation is known as [[signed zero]], with the latter form sometimes called negative zero. These representations include the [[signed magnitude]] and [[ones' complement]] binary integer representations (but not the [[two's complement]] binary form used in most modern computers), and most [[floating-point arithmetic|floating-point]] number representations (such as [[IEEE floating point|IEEE 754]] and [[IBM hexadecimal floating-point|IBM S/360]] floating-point formats). An [[epoch (computing)|epoch]], in computing terminology, is the date and time associated with a zero timestamp. The [[Unix epoch]] begins the midnight before the first of January 1970.<ref>Paul DuBois. [https://books.google.com/books?id=lFsaBAAAQBAJ "MySQL Cookbook: Solutions for Database Developers and Administrators"]. {{Webarchive|url=https://web.archive.org/web/20170224134429/https://books.google.com/books?id=lFsaBAAAQBAJ|date=24 February 2017}}, 2014. p. 204.</ref><ref>Arnold Robbins; Nelson Beebe. [https://books.google.com/books?id=J9WbAgAAQBAJ "Classic Shell Scripting"]. {{Webarchive|url=https://web.archive.org/web/20170224134147/https://books.google.com/books?id=J9WbAgAAQBAJ|date=24 February 2017}}. 2005. p. 274.</ref><ref>Iztok Fajfar. [https://books.google.com/books?id=eHq9CgAAQBAJ "Start Programming Using HTML, CSS, and JavaScript"]. {{Webarchive|url=https://web.archive.org/web/20170224134155/https://books.google.com/books?id=eHq9CgAAQBAJ|date=24 February 2017}}. 2015. p. 160.</ref> The [[Classic Mac OS]] epoch and [[Palm OS]] epoch begin the midnight before the first of January 1904.<ref>Darren R. Hayes. [https://books.google.com/books?id=0qPfBQAAQBAJ "A Practical Guide to Computer Forensics Investigations"]. {{Webarchive|url=https://web.archive.org/web/20170224134341/https://books.google.com/books?id=0qPfBQAAQBAJ|date=24 February 2017}}. 2014. p. 399.</ref> Many [[Application programming interface|APIs]] and [[operating system]]s that require applications to return an integer value as an [[exit status]] typically use zero to indicate success and non-zero values to indicate specific [[error code|error]] or warning conditions.<ref>{{cite book |author=Rochkind |first=Marc J. |url= |title=Advanced UNIX Programming |publisher=Prentice Hall |year=1985 |isbn=0-13-011818-4 |series=Prentice-Hall Software Series |location=Englewood Cliffs, New Jersey}} Section 5.5, "Exit system call", p.114.</ref>{{citation needed|date=December 2023|reason=Give citations about a couple of other APIs / OSs.}} Programmers often use a [[Slashed zero#Usage|slashed zero]] to avoid confusion with the letter "[[O]]".<ref>{{Cite web |date=18 August 2010 |title=Font Survey: 42 of the Best Monospaced Programming Fonts |url=https://www.codeproject.com/Articles/30040/Font-Survey-42-of-the-Best-Monospaced-Programming |url-status=live |access-date=22 July 2021 |website=codeproject.com|archive-url=https://web.archive.org/web/20120124051919/http://www.codeproject.com:80/Articles/30040/Font-Survey-42-of-the-Best-Monospaced-Programming |archive-date=24 January 2012 }}</ref>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)