CSCI 255 Data Types vol. 1

Integer data types of Java

The char data type is designed for Unicode characters.

Integer data types of C

Quotes are from The C Programming Language by Kernighan and Ritchie.


Arithmetic with unsigned integers "obey the laws of arithmetic modulo 2n". Because signed integers are not required to be two's complement, many of their operations do not have a tight formal definition. For example, -5/2 could be either -2 or -3. If -5/2 is -2 then -5%2 must be -1, and if -5/2 is -3 then -5%2 must be 1; that is (-5/2)*2+5%2 must be 5.

The ANSI C standard requires that both the short int and the plain int be able to hold integers from -32767 to 32767 when signed and from 0 to 65535 when unsigned. The long int must be able to hold integers from -2147483647 to 2147483647 when signed and from 0 to 4294967295 when unsigned.


The C99 standard includes a long long integer which is required to hold at least 64 bits.

Solutions through includes