Char Literal : Char « Data Type « Visual C++ .NET






Char Literal

 
#include "stdafx.h"
#using <mscorlib.dll>
using namespace System;

Int32 main(void)
{
    Byte a = 'a';        // character 'a'
    Char b = L'b';       // Unicode 'b'

    Byte t = '\t';       // tab escape
    Char s = L'\\';      // Unicode backslash escape

    Byte d = '\45';      // octal escape
    Char e = L'\x0045';  // Unicode hexadecimal escape

    Console::WriteLine ( a ); 
    Console::WriteLine ( b ); 
    Console::WriteLine ( t ); 
    Console::WriteLine ( s ); 
    Console::WriteLine ( d ); 
    Console::WriteLine ( e ); 

    return 0;
}

   
  








Related examples in the same category

1.Unicode hexadecimal escape
2.Octal escape
3.Character Literals in Action
4.Unicode escape
5.Character Fundamental Type
6.Intialize using charater literal