Char: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 5: Line 5:
</source>
</source>


{{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.}}
{{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.}}


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.

Revision as of 00:22, 4 February 2011

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
Tip.pngTip: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.

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.

See also