Data Types in C#

aaaaaaaaaaaaaaaaa

Basic Data Types

Type Size in Bits Value Standard
bool 8 true or false
byte 8 0 to 255 unsigned
sbyte 8 -128 to +127
ushort 16 0 to 65,535 unsigned
uint 32 0 to 4,294,967,295 unsigned
ulong 64 0 to 18,446,744,073,709,551,615 unsigned
object
string Unicode character set

Variable

Variable is a location in computer memory where data is temporary stored OR saved.

How to use

e.g: int RollNumber = 13;

Explanation
int is Data Type of variable
RollNumber is Name of variable
13 is Value of variable

Another Example

e.g: float floatingVariable = 5.67;

Explanation
float is Data Type of variable
floatingVariable is Name of variable
5.67 is Value of variable

Difference between variable Declaration, Definition and Initialization
Variable Declaration:

int MyVariable;

Variable Definition:

MyVariable = 56;

Variable Initialization:

int MyVariable = 56;


Data Types
Data Type Byte Width Typical Range
char 1 byte -128 to 127
signed char 1 byte -128 to 127
unsigned char 1 byte 0 to 127
short 2 byte -32,768 to 32,767
signed short 2 byte -32,768 to 32,767
int 4 byte -2,147,483,648 to -2,147,483,647
signed int 4 byte -2,147,483,648 to -2,147,483,647
unsigned int 4 byte 0 to 4,294,967,295
unsigned short 2 byte 0 to 65,535
float 4 byte 1.5 * 10-45 - 3.4 * 1038, 7-digit precision
double 8 byte 5.0 * 10-324 - 1.7 * 10308, 15-digit precision
long 8 byte ?9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
signed long 8 byte ?9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
unsigned long 8 byte 0 - 18,446,744,073,709,551,615
decimal 16 byte at least -7.9 * 10?28 - 7.9 * 1028, with at least 28-digit precision

Special Characters
Character Use for ASCII
\n OR endl Newline 10
\t Horizontal tab 9
\v Vertical tab 11
\b Backspace 8
\r Carriage return 13
\f Formfeed 12
\a Alert 7
\\ Backslash 92
\? Question mark 63
\' Single quotation mark 39
\" Double quotation mark 34
\ooo Octal number --
\xhhh Hexadecimal number --
\0 Null character 0