什么是 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