C# 0 The Complete Reference



Download 4,07 Mb.
Pdf ko'rish
bet114/1096
Sana23.01.2022
Hajmi4,07 Mb.
#402171
1   ...   110   111   112   113   114   115   116   117   ...   1096
Bog'liq
C-Sharp 3 The Complete Reference Herbert Schildt

(x / y)

 to 


int

 results in the truncation of the 

fractional component, and information is lost.

No loss of information occurs when 



b

 is assigned the value 255 because a 



byte

 can hold 

the value 255. However, when the attempt is made to assign 

b

 the value 257, information 

loss occurs because 257 exceeds a 

byte

’s range. In both cases the casts are needed because 

there is no implicit conversion from 

int

 to 


byte

.

When the 



short

 variable 



s

 is assigned the value 32,000 through the 



uint

 variable 



u

, no 


data is lost because a 

short

 can hold the value 32,000. However, in the next assignment, 



u

has the value 64,000, which is outside the range of a 



short

, and data is lost. In both cases the 

casts are needed because there is no implicit conversion from 

uint

 to 


short

.

Next,



u

 is assigned the value 64,000 through the 



long

 variable 



l

. In this case, no data is 

lost because 64,000 is within the range of a 

uint

. However, when the value –12 is assigned 

to

u

, data is lost because a 



uint

 cannot hold negative numbers. In both cases the casts are 

needed because there is no implicit conversion from 

long

 to 


uint

.

Finally, no information is lost, but a cast is needed when assigning a 



byte

 value to 

a

char

.

www.freepdf-books.com




Download 4,07 Mb.

Do'stlaringiz bilan baham:
1   ...   110   111   112   113   114   115   116   117   ...   1096




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish