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........
本文介绍了C语言中的基本概念——常量与变量。详细解释了常量的定义及不同类型,包括数值型常量、字符常量、字符串常量等,并探讨了如何在程序中正确使用这些常量。此外,还讲解了变量的概念及其声明规则。

被折叠的 条评论
为什么被折叠?



