Let us learn C in Code <3>_constant
2014-03-19 20:23
309 查看
This chapter relates with some basic conception , the constant ,as this word means , the constant is never changed. In C language, the constants are fixed value that don't change during the execution. Another way we can take constants as numbers. For
example, 1, -2, 9999, 1.12 , PI(3.1415...) 0xFF (hexadecimal) 0123 (octal) 0b1010 (binary), 1.5e456...
They are all constants, there are the character constants ,like 'a' 'A' 'b' 'B' etc. Oh almost forget the string type constants ,examples are "Hello world" ,"GOOD JOB",.....Here we must focus on the quotes , single quotes ' ' and double quotes " ". When
I was freshman ,I always confused by the quotes.Lately , i found that the single surely represented a single alphabet , double followed many alphabets . Now there are also some common constants ,represent one character but consist of two characters like
'\n','\0','\a'....these constants used to output functions, in the further chapters I will tell u.
In "Let us learn C in Code <2>" or previous series , we know the keyword and variables ,for example , "float a = 1.0"; "float b = 2.0". float is keyword , a and b are variables ,
The variable is a data name or a place to hold the data , how can we declare a variable and what 's the rules ?
Variable XXXXXX.....
Position 1234678.....
0) the first position must be a letter or underscore "_", other position is digital ,letter,or underscore.
1) the position is more than 0 but less than 31(not sure ) Another way of saying the variable is less than 31 characters;
2) The variable is not a keyword;
3) Any character is not white space;
4) Significant with Uppercase and lowercase, so “int Hello = 0;" and" int hello = 0;" represent different variables.
Ok ,that's enough, before finishing this chapter ,let us solve the problem previous article described.
main()
{
float a = 1.0;
float b = 2.0;
float c = 0;
c = a +b;
}
Have a nice day! Good night everyone who see this blog. Thank you........
example, 1, -2, 9999, 1.12 , PI(3.1415...) 0xFF (hexadecimal) 0123 (octal) 0b1010 (binary), 1.5e456...
They are all constants, there are the character constants ,like 'a' 'A' 'b' 'B' etc. Oh almost forget the string type constants ,examples are "Hello world" ,"GOOD JOB",.....Here we must focus on the quotes , single quotes ' ' and double quotes " ". When
I was freshman ,I always confused by the quotes.Lately , i found that the single surely represented a single alphabet , double followed many alphabets . Now there are also some common constants ,represent one character but consist of two characters like
'\n','\0','\a'....these constants used to output functions, in the further chapters I will tell u.
In "Let us learn C in Code <2>" or previous series , we know the keyword and variables ,for example , "float a = 1.0"; "float b = 2.0". float is keyword , a and b are variables ,
The variable is a data name or a place to hold the data , how can we declare a variable and what 's the rules ?
Variable XXXXXX.....
Position 1234678.....
0) the first position must be a letter or underscore "_", other position is digital ,letter,or underscore.
1) the position is more than 0 but less than 31(not sure ) Another way of saying the variable is less than 31 characters;
2) The variable is not a keyword;
3) Any character is not white space;
4) Significant with Uppercase and lowercase, so “int Hello = 0;" and" int hello = 0;" represent different variables.
Ok ,that's enough, before finishing this chapter ,let us solve the problem previous article described.
main()
{
float a = 1.0;
float b = 2.0;
float c = 0;
c = a +b;
}
Have a nice day! Good night everyone who see this blog. Thank you........
相关文章推荐
- Linux C函数参考手册(PDF版)
- C#实现打造气泡屏幕保护效果
- C/C++数据对齐详细解析
- C 语言基础教程(我的C之旅开始了)[三]
- C 语言基础教程(我的C之旅开始了)[七]
- C/C++ 宏详细解析
- 用C#生成不重复的随机数的代码
- 在c和c++中实现函数回调
- 浅析C/C++中被人误解的SIZEOF
- C 语言基础教程(我的C之旅开始了)[六]
- C/C++函数调用的几种方式总结
- c/c++中变量的声明和定义深入解析
- 浅析c与c++中struct的区别
- 深入详解C编写Windows服务程序的五个步骤
- 深入理解C/C++混合编程
- C 语言基础教程(一)颜色加亮
- 关于《C和指针》的学习笔记
- c_str()的用法详细解析
- C/C++中可变参数的用法详细解析