The caret // is an inverted V-shaped grapheme. Specifically, caret commonly refers to the spacing character ^ in ASCII (at code point 5Ehex) and other character sets that may also be called a hat, control, uparrow, or less frequently chevron, xor sign, to the [power of], fang, shark (or shark-fin), pointer (in Pascal), or wedge. Officially, this character is referred to as circumflex accent in both ASCII and Unicode terminology (because of its historical use in overstrike), whereas caret refers to a similar but lowered Unicode character: U+2038 ‸ caret. Additionally, there is another lowered variant with a stroke: U+2041 ⁁ caret insertion point.
The caret and circumflex are not to be confused with other chevron-shaped characters, such as U+028C ʌ latin letter turned v or U+2227 ∧ logical and, which may occasionally be called carets too.
The caret was originally used, and continues to be, in handwritten form as a proofreading mark to indicate where a punctuation mark, word, or phrase should be inserted in a document. The term comes from the Latin caret, "it lacks", from carēre, "to lack; to be separated from; to be free from". The caret symbol is written below the line of text for a line-level punctuation mark such as a comma, or above the line as an inverted caret (cf. U+02C7 ˇ caron) for a higher character such as an apostrophe; the material to be inserted may be placed inside the caret, in the margin, or above the line.
A raised variant of the symbol can be found on some typewriters, where it is used to denote a circumflex in some languages, such as French and Portuguese. It is typically a dead key, which does not cause the carriage to advance and thus allows the following letter to strike the same spot (below the circumflex) on the paper.
As regards computer systems, the original 1963 version of the ASCII standard reserved the code point 5Ehex for an up-arrow (↑). However, the 1965 ECMA-6 standard replaced the up-arrow with a circumflex (^), which was applicable as a diacritic as well, and two years later, the second revision of ASCII followed suit. As the early mainframes and minicomputers largely used teleprinters as output devices, it was possible to print the circumflex above a letter when needed. With the proliferation of monitors, however, this was seen insufficient, and precomposed characters, with the diacritic included, were instead introduced into appended character sets, such as Latin-1. The original circumflex character was left for other purposes, and as it did not need to fit above a letter anymore, it became larger in appearance.
The caret has many uses in programming languages. It can signify exponentiation, the bitwise XOR operator, string concatenation, and control characters in caret notation, among other uses. In regular expressions, the caret is used to mark the beginning of a string, or the beginning of a line within that string (depending on the regular expression dialect and specified options); if it begins a character class, it indicates that the inverse of the class is to be matched. Pascal uses the caret when dereferencing pointers. Go also uses it as a bitwise NOT operator.
In Smalltalk, the caret takes the function of the return statement. In a method,
^ 1 would cause the method to exit and return the number
In C++/CLI the only type of pointer is C++ pointer, and the .NET reference types are accessed through a "handle", with the new syntax ClassName^ instead of ClassName*. This new construct is especially helpful when managed and standard C++ code is mixed; it clarifies which objects are under .NET automatic garbage collection and which objects the programmer must remember to explicitly destroy. In development for Apple's Mac OS X and iOS, carets are used to create blocks, and to denote block types.
Since the character was originally not available in all character sets and keyboard layouts, ANSI C can transcribe it in form of the trigraph
??' which, even inside string literals, is equivalent to the
^ character. C++ additionally supports tokens like xor (for "^") and xor_eq (for "^=") to avoid the character altogether. RFC 1345 recommends to transcribe the character as digraph
'>, if not available.
Surrogate symbol for superscript and exponentiation
In mathematics, the caret can signify exponentiation (3^5 for ), where the usual superscript is not readily usable (as on some graphing calculators). The caret is also now used to indicate a superscript in TeX typesetting. As Isaac Asimov described it in his 1974 "Skewered" essay (on Skewes' number), "I make the exponent a figure of normal size and it is as though it is being held up by a lever, and its added weight when its size grows bends the lever down." The use of the caret for exponentiation can be traced back to ALGOL 60, which expressed the exponentiation operator as an upward-pointing arrow, intended to evoke the superscript notation common in mathematics. The upward-pointing arrow is now used as a form of iterated exponentiation in Knuth's up-arrow notation.
C:\> ECHO Show greater than: ^> pipe: ^| less than: ^< caret: ^^ and ^%TMP^% and ^& Show greater than: > pipe: | less than: < caret: ^ and %TMP% and &
In Italian, the caret is sometimes used in a similar manner to the ordinal indicator, most noticeably on tickets from Trenitalia, the primary operator of trains within Italy, and Rome's ATAC public transit system. On Trenitalia tickets, the travel class is often written as 1^ or 2^, meaning first class or second class respectively. This is due to the lack of the feminine ordinal indicator (-a) used in Italian in the ASCII set (the masculine ordinal indicator is usually replaced by the degree sign when extended characters are not available or in less accurate typesetting).
In social network services such as Twitter, a caret placed before a word is used to tag that word as an individual's signature within a group account. This differentiates an individual's contribution from a group-authored contribution.
In internet forums, social networking sites such as Facebook, or in online chats, a caret or a series of carets may be used beneath or after the post of one user by another user. In this usage, the caret ^ represents an upwards-pointing arrow meaning for readers, posters or the original post (OP) to see the above line/post, and in addition to the arrow usage, can also mean that the user who posted the ^ agrees with the above post. Multiple carats will indicate the comment is replying to or relating to the post above that correlates with the amount of carats used.
- "ASCII". The Jargon File 4.2.0. Arjan de Mes. 31 January 2000. Retrieved 19 August 2012.
- "AT & T's Baudot to ASCII". Stephen Williamson Computing Services. Retrieved 19 August 2012.
- Unicode (1991–2012). "C0 Controls and Basic Latin". Retrieved 19 August 2012.
- Unicode (1991–2012). "General Punctuation". Retrieved 19 August 2012.
- Unicode (1991–2012). "IPA Extensions". Retrieved 20 August 2012.
- Eric W. Weisstein. "Caret". MathWorld. Wolfram. Retrieved 20 August 2012.
- MLA Handbook for Writers of Research Papers (7 ed.). New York: Modern Language Association. 2009. p. 121. ISBN 978-1-60329-024-1.
- "Caret". Merriam-Webster. Retrieved 19 August 2012.
- Publication Manual of the American Psychological Association (5th ed.). Washington, DC: American Psychological Association. 2001. p. 338. ISBN 1-55798-791-2.
- Tom Jennings. "ASCII: American Standard Code for Information Infiltration". Retrieved 14 September 2010.
- Jukka K. Korpela (18 January 2010). "Kirjainten tarinoita" (in Finnish). pp. 132–133. Retrieved 14 September 2010.
- RFC 1345
- Isaac Asimov (1974), "Skewered", Of Matters Great and Small, Doubleday, ISBN 978-0385022255
- "What is Caret?". Computer Hope. Retrieved 14 August 2012.