Arduino Programming Language: UnsignedInt


unsigned int


Datatype 'unsigned int' occupies two byte (16 bit) and it stores an integer number(number without a decimal point)between 0 to 65535. 
On the Arduino Due datatype 'unsigned int' occupies four byte (32bit) and it stores an integer number between0 to 4.294.967.295



unsigned int var
unsigned int var = value


  • var: variable name
  • value: any integer number between 0 to 65535




When it is exceeded the maximum capacity it 'rolls over' back to the minimum capacity. This happens in both directions.

unsigned int x
x = 0;
x = x - 1; // x now contains 65535
x = x + 1; // x now contains 0


unsigned int a; // It declares an integer variable 'a'

a = 5; // It assigns to 'a' the value 5

unsigned int b = 105; // It declares integer variable 'b' and it assigns the value 105

unsigned int c = a + b; // It declares a variable 'c' as the sum between other two integer variables

Based on the reference originally written by Arduino Community, and