码迷,mamicode.com
首页 > 其他好文 > 详细

第三章 变量与常量

时间:2018-09-04 17:02:15      阅读:140      评论:0      收藏:0      [点我收藏+]

标签:变量   bubuko   第三章   print   技术   span   image   size   col   

技术分享图片

 

常量

当在类型名前面加上关键字 const 后,表示它是一个只读的量.这种变量不能修改它的值,因而称为常量.

#include<iostream>
int main()
{
    const int MAX_SIZE = 1024;
    printf("a : %d \n",MAX_SIZE);    // 读取 const 常量的值
    int b = MAX_SIZE;                // 将 MAX_SIZE 的值赋值给变量 b
    printf("b:%d \n",b);
    return 0;
}

 

第三章 变量与常量

标签:变量   bubuko   第三章   print   技术   span   image   size   col   

原文地址:https://www.cnblogs.com/QLEO/p/9585015.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!