char Type क्या है
एक char बिल्कुल एक letter, digit, या symbol रखता है, जैसे किसी word game की एक tile। इसे single quotes से लिखा जाता है।
In this page:
Syntax
char variableName = 'A';
int code = (int)variableName;
bool isDigit = char.IsDigit(variableName);
The char Type
एक char एक single UTF-16 character को represent करता है और single quotes से लिखा जाता है, जैसे A। Characters को compare, उनके underlying numeric code point में cast, और strings में combine किया जा सकता है। Double quotes string के लिए reserved हैं, char के लिए नहीं।
Note:
किसी
char को int में cast करने पर आपको उसका Unicode code point मिलता है।उदाहरण: The char Type
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));
}
}
Login to try C/C++/Java/PHP code in the editor
Related Topics
{# common_mistakes/chapter_summary/browser_support: on Hindi pages the
view already swaps in the hi_ translation fields (or blanks these
out if untranslated), so this renders correctly for both languages
without a lang_code check here. #}
आम गलतियां
- किसी
charके लिए double quotes का उपयोग करना, जैसेchar c = "A";, जबकि char को single quotesAचाहिए। - यह उम्मीद करना कि
a + 1एक char होगा, जबकि result एकintहै और इसेcharमें cast चाहिए। abजैसे किसी char literal में एक से ज़्यादा characters डालने की कोशिश करना।
🔒
Chapter Quiz — Complete all 7 topics to unlock
0/7 topics done
Complete these topics first: