C # study notes (a)

A data type:

1. The basic range of integer data types and Java almost

sbyte a byte (note this place and java named differently)

short two bytes

int four bytes

eight bytes long

Then divided type of signed and unsigned, are unsigned type

After the byte ushort uint ulong unsigned, plus a number of data bits, the number of increases in the positive direction, and the actual data range is not increased.

2. The basic floating-point data types and Java data types almost

They are float and double two kinds

The data size of four bytes, respectively, and eight bytes

Although the float will automatically rounded up after the int data type and scope of the same, but you can save seven decimal data longer

float ---> without loss of data is double, double ---> If float float double decimal longer acceptable range, data loss may occur

3. Character

Divided into char and string

a two-byte character char can store a character, long missing data automatically

string must be lowercase, to store a variety of data.

4. Boolean

boolean and most programming languages, only the value true, flase or empty

The initialization values ​​of various data

Integer type sbyte, byte, short, int, long default initial value 0

Float float, double default initial value of 0

Char character data initial value is a string initially vacant

The initial value of the Boolean type boolean false, true

Guess you like

Origin www.cnblogs.com/ad-zhou/p/11137034.html