Let us learn C in Code _constant

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........

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章