An Explaination of Special Keyboard Characters

The many characters available on standard English keyboards once have meanings that are lost on most people today. These characters are mostly punctuational and notational and were carried over from typewriter keyboards(with the exception of the of the "cents" symbol: ¢). Programmers have made good use of these extra characters as shortcuts for functions.


Index

~  `  !  @  #  $  %  ^  &  *  ()  -  _  +  =  |  \  {}  []  :  ;  ""  '  > <  ,  .  /  ?  ENTER  SHIFT 


~ Tilde

Probably one of the least know names for a special character. I tell people all the time to "type a tilde," and they respond, "A WHAT!?!" A tilde is used in punctuation as a diacritical mark to indicate a nasal sound to a word in Spanish or Portuguese. In the computer world a tilde is used to represent an assumed file path or a truncated file name.

Examples:
http://www.host.com/~subhost/ used to represent a hidden portion of a Web address.
longfilen~1.txt The full name might be longfilename.txt but the operating system truncates it.

In C++ a tilde indicates a destructor in class behavior.
Example:
MyClass::MyClass( )
{
   MyClass( ); //constructor*

   ~MyClass( ); //destructor

}
*A constructor allocates space for a class execution and then the destructor frees that space up again.


` Backtick/Grave Accent

Used in French words and Anglicized French words. Used to represent verbal stress on a letter or syllable. This is not used much in programming I am familiar with. I have only seen it used in Perl regular expressions.


! Exlaimation Point

Used in to emphasize, express surprise, anger or strong emotion.
The exclaimation point is often used in programming as the logical operator NOT.
Examples:
5 != 6 Five is NOT equal to six.



@ At symbol

A shorthand way of writing "at." "Meet me @ 5:30."
This has become one of the most familiar special characters because every email address uses it.

Example:
user@host.com

Perl uses the @ before array data types.
DOS batch files use @ to hide commands from being displayed.
VAX systems also use @ to point to file locations.



# Num/Number/Pound/Hash-Mark

A shorthand way of writing "number." "We're #1," "Use a #2 Pencil." Also found on telephone touchpads and used for retreiving voicemail messages or sending pages. This button was origonally used by telephone repair personnel for testing various functions and is known as "pound" in the telephone world.
In Perl the # is used to comment-out text so it won't be read as code
Example:
$myscalar = 25; Read by interpreter.
#assigns 25 to $myscalar Not read by interpreter.

In C based languages the # is used in code library declarations or "preprocessor directives."
Examples:
#include< stdio.h >
#define PI 3.14

In some UNIX systems the # is used as a command-line prompt.



$ Dollar Sign

Common prefix for indicating amounts of U.S. currency. Made from the combination of the letters "U" and "S." In UNIX systems the $ is sometimes used as a command-line prompt.
The $ is used in Perl to indicate a scalar data type.
Example:
$myscalar


% Percent Sign/Modulator

A short hand way for representing percent. "100%." The symbol comes from the fraction 1/100.
In languges like C and Java, it is an operator called the modulator. A modulating function results in the opposite quotient of division, the remander. Dividing 6 by 4 will produce 1.5, modulating 25 by 3 would produce 5. Modulation is often used for error checking, to see if numbers divide evenly and produce a remainder of zero. In Perl, % is placed before a variable to indicate that it is of the hash data type.

Example:
%myhash


^ Caret/Circumflex Accent

The caret is used to edit text. It is placed to indicate where a word or text should be inserted. Caret is Latin for "something is lacking."
As a Cicumflex Accent, it is used in French over letters to indicate stress or quality of pronounciation.

In many C based languages the ^ is used as the boolean operator for exclusive OR.

Example:
if((x==2)^(x==1)){
print"Condition Met!";
}



& Ampersand

The Ampersand is a shorthand way of writing "and." "Milk & butter."
In HTML the & is used at the begining of Character Entities.
In C based languages as the boolean operator AND.



* Asterix/Star

Can also be found on the telephone pad. Is used in most code as the multiplication operator.
Example:
c = b * a A times B equals C.

In C++ it is also used as the Indirection Operator or the Difference Operator. It is used to save space for pointers. I think this is really stupid. Why they used the same symbol as the one for multiplication, I don't know, but we're stuck with it.

In command line environments, * is used to represent a wildcard.


- Hyphen/Minus/Dash

As a Hyphen, this symbol is used in english to link two words that make a single term but cannot be written as one word. "Twenty-three," "state-wide", "X-ray." As the Dash(technically, typed the Dash would be two Hyphens '--') it is used to represent paterns in natural speech when written: "I--I can't go in, I'm--scared!"
In programming it is typically used as the subtraction operator as it is in written math. "2 - 1 = 1."
In C based codes a double minus is a unary decrement operator. Meaning alone with a variable it does the job decrementing the value by 1.
Example:
x = 3;
x--;
x now equalls 2.



_ Underscore

Computers have problems understanding blank spaces. Names of files, directories and datatypes must all be one word. There are several conventions for this. One is the capitalize-every-other-word, as in thisIsMyFile. This can be hard to read. An alternative is the underscore, this_is_my_file. Much easier to read and wont cause errors.


= Equals

In most code this is know as the assignment operator. It has the same function it does in normal math, but it is used slightly different. Whereas, in math the equation "3 + 4" would be followed by "= 7". The equals sign is the point of balance between both sides of the equation. The value of 7 is the same value as 3 + 4. In program code the equals sign assigns one value to a variable. In C based code, x = 3 + 4 would assign the value 7 to the variable x. But this could also be done by the statement x = 7. I know that still looks very much like math, but you can also assign non-numeric values with the equals sign. name = "John Smith" assigns the value John Smith to the variable name. x = y assigns the value of y to the variable x.

An important thing to remeber is that all assignment is done from right to left. "3 + 4 = x" is not a valid code line. The compiler will try and assign the value of "x" to 3, +, and 4. This will produce an error because 1. You can only assign values to one variable at a time, 2. x has no value(presumably), and 3. 3 & 4 are literal values and + is an operator and none of these can take values.

An important distinction to make is the difference between =, the assignment operator and = =, the evaluation operator. = = evaluates two values to see if the are equivalent.
Examples:
4 = = x; is x equal to 4?
John = = JOHN is John the same as JOHN?
= = is a boolean operator.



+ Plus

Used as the addition operator in most code, but can also be used to link stings.
Example:
print "Happy" + "Birthday"


\ Backward Slash/Backslash

Multiple uses.
As a directory delimiter in DOS/Windows systems.
Example:
C:\WINDOWS\DESKTOP\

At the begining of escape characters in some code.
Examples:
\n The "new line" character.
\t The "tab" character.



/ Slash/Forward Slash

Multiple uses.
As the division operator in most code.
Example:
c = a / b; C equals A divided by B.

As a directory delimiter in most UNIX systems.
Example:
usr/cgi_bin

As a directory delimiter in World Wide Web directories.
Example:
mysite/mysubdirectory/mypage.html

To mark the end of a protocol and the begining of a file name.
Examples:
http://www.site.com
ftp://ftp_site.com

To mark a closing HTML tag.
Examples:
< TITLE > Title of Page < /TITLE >
< BODY > Body of page < /BODY >

Two backslashes in C based code indicate a comment.
Example:
//This is not read by the computer!

A backslash an an astrix in C based code indicate a long comment.
Example:
/*This comment may span several lines*/




| Pipe




. Period

In most western languages . indicates the end of a sentence. It is also use to mark decimal points(But not in Europe! They use a comma!).

Used to separate file names from file types.
Examples:
resume.doc
spreadsheet.xls
webpage.html

Used on the Internet to specify domain types.
privatecompany.com
notforprofit.org
college.edu
masivenetwork.net
bureauofmines.gov
usarmy.mil

In C, C++ and Java the period is known as the dot operator. It does basically the samething is either language, but is used more often in Java. It is used to access Class Members.


, Comma




? Question Mark




; Semi-colon

Used as a line(statement) terminator in C, C++, Java, Perl and a few other langauges. The semi-colon tells the processor that the code statement has ended. Example:
cout << "A sample statement in C++";

In Lisp and some other AI languages it is used to indicate comments.
Example:
;;;Not read by the Lisp interpreter



: Colon




" Quote/Double Qoute




' Qoute/Single Quote




< Less Than




> Greater Than




[ ] Brackets/Braces




{ } Curly Brackets




( ) Parantheses




Carriage Return/Return/Enter

For those old enough to remember using mechanical typewriters, electric typewriters and terminal/host computer systems are aware of the origins of these buttons. On most computer systems today return and enter are used interchangably. Typical keyboards have a < RETURN > and an < ENTER > key which basically do the same thing. These are holdovers from evolving technology that is based on, believe it or not, Medeval typsetting systems.

Carriage Return
Manual typewriters held the paper in "carriage" of sorts. As the typist struck a key, the carriage would move the paper one space. At the end of a line the typist would hit the "Return" key which would skip one line down on the paper