Tuesday, 6 August 2013

how does this assignment work in c#?

how does this assignment work in c#?

My question is that how does this assignment happen in c#? I mean, how
does it calculate the answer 1 (with 257), and how does it calculate
0(with 256)?
the code is:
int intnumber=257;
byte bytenumber=(byte)intnumber;//the out put of this code is 1
int intnumber=256;
byte bytenumber=(byte)intnumber;//the out put of this code is 0
My question is what happen,that the output in first code is:1 and in
second one is:0

No comments:

Post a Comment