1. Variables
The amount of time that can be changed while the program is running
Define and initialize
3.14
2. Constants
The amount of time that a program cannot be changed while it is running, and it can be any basic data type .
such as Integer constants, floating-point constants, character constants, or string constants, as well as enumeration constants
Methods for defining constants
Add a keyword "const" before defining a variable
Const int a=;
3. Data type
There are three types of data in C #, value types, reference types, and pointer types.
Value type
Also known as the basic data type, each value type has a separate memory area to hold its own value, and calls it when it calls his value.
| type |
Description |
Range |
Default Value |
| bool |
Boolean value |
True or False |
False |
| Byte |
8-bit unsigned integer |
0 to 255 |
0 |
| Char |
16-bit Unicode characters |
U +0000 to u +ffff |
' + ' |
| Decimal |
128-bit exact decimal value, 28-29 significant digits |
( -7.9 x 1028 to 7.9 x 1028)/100 to 28 |
0.0M |
| Double |
64-bit double-precision floating-point |
(+/-) 5.0 x 10-324 to (+/-) 1.7 x 10308 |
0.0D |
| Float |
32-bit single-precision floating-point |
-3.4 x 1038 to + 3.4 x 1038 |
0.0F |
| Int |
32-bit signed integer type |
2,147,483,648 to 2,147,483,647 |
0 |
| Long |
64-bit signed integer type |
923,372,036,854,775,808 to 9,223,372,036,854,775,807 |
0L |
| SByte |
8-bit signed integer type |
128 to 127 |
0 |
| Short |
16-bit signed integer type |
32,768 to 32,767 |
0 |
| UInt |
32-bit unsigned integer type |
0 to 4,294,967,295 |
0 |
| ULong |
64-bit unsigned integer type |
0 to 18,446,744,073,709,551,615 |
0 |
| UShort |
16-bit unsigned integer type |
0 to 65,535 |
0 |
Reference type
(4) C # variables, constants, data types, data conversions