Char: Difference between revisions
Jump to navigation
Jump to search
Tip:Despite its name, there is no need for char to be used to store character data. It can also be employed simply as a means of storing one byte of data.
No edit summary |
SirYodaJedi (talk | contribs) No edit summary |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{ | {{lang|Char}} | ||
| | |||
}} | |||
'''<code>char</code>''' is the amount of memory needed to store one [[W:ASCII|ASCII]] character. On architectures that Source supports, this is one [[W:byte|byte]] or eight [[W:bit|bit]]s. | '''<code>char</code>''' is the amount of memory needed to store one [[W:ASCII|ASCII]] character. On architectures that Source supports, this is one [[W:byte|byte]] or eight [[W:bit|bit]]s. | ||
Line 11: | Line 9: | ||
Arrays of <code>char</code> or <code>[[wchar_t]]</code> are known as [[string]]s, and are used to store text. <code>char*</code> means a [[pointer]] to a char, which is almost always the start of a string. | Arrays of <code>char</code> or <code>[[wchar_t]]</code> are known as [[string]]s, and are used to store text. <code>char*</code> means a [[pointer]] to a char, which is almost always the start of a string. | ||
In {{goldsrc|2}} and {{source|2}}, unsigned chars (0-255) are typedefed as {{codelink|byte}}. | |||
== See also == | == See also == | ||
* [[String]] | * [[String]] | ||
* <code>[[wchar_t]]</code> | * <code>[[wchar_t]]</code> | ||
[[ | [[Category:Variables]] | ||
[[Category:Glossary]] | [[Category:Glossary]] | ||
Latest revision as of 08:08, 3 May 2025
char
is the amount of memory needed to store one ASCII character. On architectures that Source supports, this is one byte or eight bits.
char MyChar = 'T'; // single quote marks

Arrays of char
or wchar_t
are known as strings, and are used to store text. char*
means a pointer to a char, which is almost always the start of a string.
In GoldSrc and
Source, unsigned chars (0-255) are typedefed as byte.