const.c
来自「C源码集」· C语言 代码 · 共 27 行
C
27 行
#include <stdio.h>int main (void){ double f = 5000000000.0; double g = 5000000000; const int DaysinMay = 31; /* don't have to mess with L, e, ., etc. if use const */ /* f prints out OK but g gives overflow value as integer constant has been created and is over the max int size */ printf("f=%f \n", f); printf("g=%f \n", g); g = 33.3; printf("g=%f \n", g); // can change the value of a literal constant. It is an lvalue// DaysInMay = 30;// printf("Days in May = %d \n", DaysInMay); // but can't change the value of a named constant. It is an rvalue return 0;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?