C/C++ 常量的定义与应用(编程中的常量)

  • 常量一般定义为全局变量,且大写;

1. 字符串常量

const string EXPAND_X = "X+YF";
const string EXPAND_Y = "FX-Y";

2. numeric limits

#include <numeric>
numeric_limits<short>::min()/::max()
  • 16 位有符号数(signed short):-32768-32767
原文地址:https://www.cnblogs.com/mtcnn/p/9423303.html