什麼是 C++ 整型常量?
整型常量是沒有小數部分或指數的常量資料元素。它們始終以數字開頭。您可以以十進位制、八進位制或十六進位制形式指定整型常量。它們可以指定有符號或無符號型別以及長型別或短型別。
在 C++ 中,您可以使用以下程式碼建立整型常量 −
#include<iostream>
using namespace std;
int main() {
const int x = 15; // 15 is decimal integer constant while x is a constant int.
int y = 015; // 15 is octal integer constant while y is an int.
return 0;
}您可以在 https://msdn.microsoft.com/en-us/library/00a1awxf.aspx. 上找到用於指定整型常量的完整語法。
廣告
資料結構
網路
RDBMS
作業系統
Java
iOS
HTML
CSS
Android
Python
C 程式設計
C++
C#
MongoDB
MySQL
Javascript
PHP