Friday, September 12, 2008

C++ vs Java

Give a numeric expression that is valid in both C++ and Java, but
evaluates to different values.

1 comment:

Kundan said...

The expression "(int) (char) 256" gives 0 in C++ (and C) because
char type is 8-bits and truncates 256 to 0, whereas it gives
256 in Java because char type is 16-bits