Let us learn C in Code <3>_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........

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值