The abbreviation char is a reserved keyword in some programming languages, such as C, C++, C#, and Java. It is short for character, a data type that holds one character (letter, number, etc.) of data. For example, the value of a char variable could be any one-character value, such as ‘A’, ‘4’, or ‘#’.
Also, other languages that do not have char as a data type may use the abbreviation for certain methods used with string values. For example, JavaScript has methods, such as charAt() and charCodeAt(), that return values related to the calling string. The charAt() method, for example, returns a string containing one character, which is the character at the location given as a parameter to the function. Running the following code would alert the value of the character at position 2 in the string “computer hope” (starts from 0 rather than 1).
mystring = “computer hope”;window.alert(mystring.charAt(2));
The code above sends an alert with “m” because “c” is at position 0, “o” is at position 1, and “m” is at position 2.
Character, Computer abbreviations, Programming terms
Related Pages
- How to create a computer program.