0 votes
in General Knowledge by (744k points)
When would sign extension happen?

1 Answer

0 votes
by (744k points)
 
Best answer
If I wanted to cast a data type (ex: char) into a larger data type (ex: short).

ex:
short y;
char x = -27;
//-27 = 1110 0101
y = (short)x;
// y = 1111 1111 1110 0101 (in 32 bit)
Welcome to the Answerine , a great place to find, read and share your favorite questions and answers.
...