← Back to C# Course | Chapter 2: Variables & Types | Lesson 4 of 7

The char Type

In this page:

  1. The char Type

The char Type

A char represents a single UTF-16 character and is written with single quotes, like A. Characters can be compared, cast to their underlying numeric code point, and combined into strings. Double quotes are reserved for string, not char.

Note: Casting a char to int gives you its Unicode code point.

Example: The char Type

markup
using System;

class Program
{
    static void Main(string[] args)
    {
        char letter = 'A';
        char digit = '7';

        Console.WriteLine(letter);
        Console.WriteLine((int)letter);
        Console.WriteLine(char.IsDigit(digit));
    }
}
🔒

Chapter Quiz — Complete all 7 topics to unlock

0/7 topics done

Complete these topics first:

Login to run this code

C/C++/Java/PHP execution requires a free account. Your code is saved — you'll land right back in the editor after logging in.