Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - What data types does C# contain and how to declare variables?
What data types does C# contain and how to declare variables?
1. What are the basic data types?

C# has 15 predefined types, of which 13 are value types and two are reference types (string? And then what? Object)

1, integer (including: sbyte, short, int, long, byte, ushort, unit, ulong)

2. Floating-point type (decimal)

3. Decimal type (decimal)

4. Boolean type

5, char character type (char)

6. Reference type (object type and string type) (object, string)

Second, how to declare variables and assign values?

1) Defines the syntax of a variable:

Data type variable name; ? (Define an age variable, which is an integer, so the variable is defined as follows:)

Import; ? [The system will allocate different sizes of storage space in the memory according to the data type]

After each data type, you can define multiple variables, such as: (define name, home address, native place and nationality).

String? Name, address, native place and nationality? ;

2) syntax for assigning values to variables:

Variable name? =? Value;