long

描述

Long (長整數) 是一個延伸儲存空間的變數型別,它可以儲存 32bits (4 bytes) 大小的整數,從 -2,147,483,648 到 2,147,483,647。

如果長整數要和整數做數學運算,必須在整數常數最後面加上 L,強制指定此整數為長整數。其他的細節請見 整數常數 的資料

範例


long speedOfLight = 186000L;
// 詳見整數常數頁面中 ’L’ 的說明

語法


long var = val;

var – long 型別的變數名稱
val – 指派給變數的值

See also

byte
int
unsigned int
unsigned long
Integer Constants
Variable Declaration


語法參考主頁面

本頁由熱血青年 LBU 譯自英文版。

The text of the 86Duino reference is a modification of the Arduino reference, and is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.