The foundation is the top priority ~ Initial Value of Value Type

Source: Internet
Author: User

Back to directory

We need to clarify the initial values of some value types, that is, when you declare a variable, it actually has a default value.

Msdn: http://msdn.microsoft.com/zh-cn/library/83fhsxwc.aspx

 

Value Type

Default Value

Bool

False

Byte

0

Char

'\ 0'

Decimal

0.0 m

Double

0.0d

Enum

Value generated by expression (e) 0, where E is the enum identifier.

Float

0.0f

Int

0

Long

0l

Sbyte

0

Short

0

Struct

Set all value type fields to default values and all reference type fieldsNullValue.

Uint

0

Ulong

0

Ushort

0

The following table shows the integer size and range. These types constitute a subset of simple types.

Type

Range

Size

Sbyte

-128 to 127

Signed 8-digit integer

Byte

0 to 255

Unsigned 8-digit integer

Char

U + 0000 to U + FFFF

16-bit Unicode characters

Short

-32,768 to 32,767

Signed 16-digit integer

Ushort

0 to 65,535

Unsigned 16-digit integer

Int

-2,147,483,648 to 2,147,483,647

Signed 32-bit integer

Uint

0 to 4,294,967,295

Unsigned 32-bit integer

long

-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807

signed 64 integer

Ulong

0 to 18,446,744,073,709,551,615

Unsigned 64-bit integer

Back to directory

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.