Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

C Sharp char: Difference between revisions

From Coderwiki
new: info, size, example
(No difference)

Revision as of 13:01, 19 August 2025

The char data type in C Sharp is used to store a single character value, usually in a variable.

It is the base unit for the string data type (see C Sharp string).

See Char for general information about the uses and memory layout of a character data type.

Size

Values of type char take up 2 bytes in memory in C#.

This means they can store 65536 different character values.

Example

char a = 'a';
char b = '&';
string c = "hello world";
char d = c[4]; // 'o'