C 文字中的分界符部和单位
Delimiter tens and units in c++ literals
在java中我可以做:
int i = 1_200_200;
我如何在C 中做同样的事情?我的意思是我应该使用什么而不是下划线?
以来C 14您可以使用单个引号(')来提高可读性,例如。
int i = 1'200'200;
可选的单报价(')可以在数字之间插入 分隔器。它们被编译器忽略。
在C 中您可以使用普通报价。例如
#include <iostream>
int main()
{
int x = 1'234'567;
std::cout << "x = " << x << std::endl;
return 0;
}
在c中不存在这样的功能。
相关文章:
- 表示"accepting anything for this template argument" C++概念的通配符
- 助记符和指向成员语法的指针
- 芬威克树(BIT).找到具有给定累积频率的最小索引,单位为 O(logN)
- 如何用转义符替换字符串中的所有特殊字符
- 概念TS检查忽略私有访问修饰符
- 将模板与类模板扣除占位符参数匹配
- 概念中的cv限定符需要表达式参数列表
- 如何防止clang格式在流运算符调用之间添加换行符<<
- 当使用通配符和null指针调用函数时,对输出的说明
- C++中数据类型修饰符的顺序
- 从字符串变量中逐字符读取单词
- 如何在C/C++中用FD_set Unix设置套接字文件描述符
- llvm构建器向基本块添加终止符
- 如何将部分流作为参数传递
- 从 Boost ASIO 获取 epoll 描述符 io_service对象
- 标准库类型的赋值运算符的引用限定符
- 警告:在函数返回类型 [-Wignore 限定符] 时忽略类型限定符
- 是否有内置方法可以强制转换为不同的基础类型,但保留常量限定符?
- put_time具有转换说明符,该转换指定符,该指定符在一个月的单个数字上输出没有前面字符的单位天数
- C 文字中的分界符部和单位