0Pricing
C# Academy · Lesson

The char Type

Single characters in C#.

What Is a char?

In C#, char represents a single Unicode character, like a letter, digit, or symbol.

You write a char literal using single quotes, not double quotes. Double quotes are reserved for strings.

A char always holds exactly one character.

char letter = 'A';
char digit = '7';
char symbol = '#';

Printing a char

You can print a char just like any other value with Console.WriteLine.

This complete program declares a char and prints it. Notice the single quotes around the character.

class Program
{
    static void Main()
    {
        char grade = 'B';
        System.Console.WriteLine(grade);
    }
}

All lessons in this course

  1. The char Type
  2. Char Helper Methods
  3. Iterating Over Strings
  4. Building Strings
← Back to C# Academy