正在加载图片...
Chapter 3 Data types, Operators, and Expressions Constants Symbolic constants: A#define line defines a symbolic name or symbolic constant to be a particular string of characters tdefine identifier replacement text (constant) Use upper case letters It is macro definition例符号常量举例(ch21c) 如# define Direct constants #define PRICe 30 Integer constants main 运行结果:tota=300 Floating-point con Character constant int num. total String constants num=10 total=num PRICE printf("total=%od", total) 1111 – Use upper case letters – It is macro definition ,not statements. ➢ Direct constants Integer constants Floating-point constants Character constants String constants 如 #define PRICE 30 Constants ➢ Symbolic constants: A #define line defines a symbolic name or symbolic constant to be a particular string of characters . #define identifier replacement text (constant) > > > > < > 例 符号常量举例(ch2_1.c) #define PRICE 30 main() { int num,total; num=10; total=num*PRICE; printf("total=%d",total); } 运行结果:total=300 Chapter 3 Data types , Operators , and Expressions
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有