随笔分类 -  《通过例子学习C语言》

通过例子的方式,来理解、学习C语言。
摘要:限定符的作用是限定变量,而使被限定的变量具有特殊的属性,以达到我们变成的目的。通常有局部变量和全局变量,局部变量定义在函数内被,期生命周期在函数被调用的时间内;而全局变量定义在函数外部,其生命周期,贯穿始终。 接着我们说说,在嵌入式底层开发,常用的限定符:static, volatile, exte 阅读全文
posted @ 2017-05-31 23:25 Micheal_you 阅读(162) 评论(0) 推荐(0)
摘要:REMEBER: 1 continue causes the rest of an iteration to be skipped and the next iteration to be started. 2.break causes the program to break free of th 阅读全文
posted @ 2017-04-04 15:58 Micheal_you 阅读(184) 评论(0) 推荐(0)
摘要:#include #include "ctype.h" #define STOP '|' int main(void){ char c;//Initializing long n_char = 0L; int n_word = 0; int n_line = 0; int inword = 0;//This is a flag making sure ... 阅读全文
posted @ 2017-04-04 14:41 Micheal_you 阅读(132) 评论(0) 推荐(0)
摘要:while((c = getchar()) != ' ' && c != '\n') The first subexpression gives a value to c ,which then is used in the second subexpression. while(x++ < 10 && x + y < 20) The fact that the && operator is... 阅读全文
posted @ 2017-04-03 11:50 Micheal_you 阅读(127) 评论(0) 推荐(0)
摘要:REMEBER It demonstates a characteristic C programming style combing two actions in one expression. 阅读全文
posted @ 2017-04-03 11:02 Micheal_you 阅读(169) 评论(0) 推荐(0)
摘要:if (expression) statement 阅读全文
posted @ 2017-04-02 20:31 Micheal_you 阅读(146) 评论(0) 推荐(0)
摘要:1 #include 2 #include 3 int main(void){ 4 const int FIRST_OZ = 46; 5 const int NEXT_OZ = 20; 6 int ounces, cost; 7 8 printf(" ounces cost\n"); 9 for (ounces = 1, cos... 阅读全文
posted @ 2017-04-02 12:16 Micheal_you 阅读(157) 评论(0) 推荐(0)
摘要:REMEBER : You should limit yourself to using only < and > in floating-point comparisons. while(status == 1) is ture. and while(status = 1) is ture ... 阅读全文
posted @ 2017-04-02 11:59 Micheal_you 阅读(175) 评论(0) 推荐(0)
摘要:REMEBER: A for loop is appropriate when the loop involves initializing and updating a variable, and a while loop is better when the conditions are oth 阅读全文
posted @ 2017-04-02 11:43 Micheal_you 阅读(125) 评论(0) 推荐(0)
摘要:Remeber: 1 Assignment: you can assign an address to a pionter. Do not dereference an uninitialized pointer..for example, int *pt; *pt = 5.(correct : i 阅读全文
posted @ 2017-03-19 21:29 Micheal_you 阅读(179) 评论(0) 推荐(0)
摘要:Remeber : 1 C now has a function-prototyping mechanism that checks whether a function call has the correct number and correct kind of arguments . 2 th 阅读全文
posted @ 2017-03-19 18:59 Micheal_you 阅读(143) 评论(0) 推荐(0)
摘要:int function1(int x); int function2(int *ptr); Remeber: 1 Use the first form if the function needs a value for some calculation or action; 2 Use the s 阅读全文
posted @ 2017-03-19 15:30 Micheal_you 阅读(102) 评论(0) 推荐(0)
摘要:The #define statement can be used for character and string constants,too . The following example are valid: 阅读全文
posted @ 2017-03-19 12:31 Micheal_you 阅读(115) 评论(0) 推荐(0)