Unexpected output when converting to an integer with int()

It has been years since programming in C and it will be nice to become familiar again with details like these ...

... and if you programmed on a PC or minicomputer in C, then C++ for microcontrollers is even more distant.
Underneath the Arduino GUI is the AVR GCC compiler:
http://www.avrfreaks.net/wiki/index.php/Documentation:AVR_GCC#Getting_started_with_AVR-GCC

There is also the AVR-LIBC library that is available:
http://www.nongnu.org/avr-libc/
and use with Arduino introduced here:

Things to keep in mind:

  • You can generally swing between Arduino'ish commands and C++ commands
  • You can resort to extern C {} or you can do inline assembler as advance coding.

The compiler does a tremendous amount of optimizations ... sometimes taking out some of your code or even rearranging it. Never assume. If you really want to know what happened, you can get the assembler source with just a little work.

IF you are using Windows, you can also get information on the Flash and SRAM usage of your code with a little scripting:
(adjust paths are required)

PATH=%path%;C:\Program Files\Arduino_105\hardware\tools\avr\utils\bin;
CD %TEMP%
MD %PUBLIC%\ELFtemp
for /R %TEMP% %%f in (*.elf) do XCOPY /D /Y %%f %PUBLIC%\ELFtemp\
DIR %PUBLIC%\ELFtemp\*.elf /s /b /O:-D /T:W >ElfRhere
SET /P ELF= <ElfRhere
ECHO %ELF% >MemUsage.txt
AVR-SIZE -C %ELF% >>MemUsage.txt
NOTEPAD MemUsage.txt
SET ELF=""

Ray