Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Character | Dealing with Data Types
C# Basics

CharacterCharacter

The keyword char represents a single character. A character value is always enclosed in single quotes (').

cs

main.cs

Every character represents an integer value in the ASCII table. The ASCII table is a fundamental character encoding system used in computers to represent text and symbols. Each character, like letters, numbers, and punctuation marks, is assigned a unique numerical value that computers understand. This allows computers to exchange and display information in a standardized way.

For example, the character a represents the value 97 while b represents 98. You can view the ASCII table at: ASCII table link We can perform arithmetic operations on the characters. The operations always return an integer value based on the ASCII values of the characters being operated. For-example:

cs

main.cs

The above code outputs 195 because the sum of the ASCII values of a and b is 195.

The digits from 0 to 9 can also be represented as characters by enclosing them in single quotes:

However, digits represented as characters are NOT the same as integers.

Which one of these is a char value?

Виберіть правильну відповідь

Все було зрозуміло?

Секція 2. Розділ 5
course content

Зміст курсу

C# Basics

CharacterCharacter

The keyword char represents a single character. A character value is always enclosed in single quotes (').

cs

main.cs

Every character represents an integer value in the ASCII table. The ASCII table is a fundamental character encoding system used in computers to represent text and symbols. Each character, like letters, numbers, and punctuation marks, is assigned a unique numerical value that computers understand. This allows computers to exchange and display information in a standardized way.

For example, the character a represents the value 97 while b represents 98. You can view the ASCII table at: ASCII table link We can perform arithmetic operations on the characters. The operations always return an integer value based on the ASCII values of the characters being operated. For-example:

cs

main.cs

The above code outputs 195 because the sum of the ASCII values of a and b is 195.

The digits from 0 to 9 can also be represented as characters by enclosing them in single quotes:

However, digits represented as characters are NOT the same as integers.

Which one of these is a char value?

Виберіть правильну відповідь

Все було зрозуміло?

Секція 2. Розділ 5
some-alt