編譯器可以從初始化資料推斷出變數的型別。因此,定義 auto iVar = 11; 與定義 int iVar = 11; 相同(因為 11 是一個 int 字面量)。
auto iVar = 11;
int iVar = 11;
11
int
有關從初始化資料推斷型別的更多資訊(包括互動式示例)