内容简介 · · · · · ·
本书适合做零基础的初学者学习C语言的第一本教材,帮助读者打下牢固的基础。有一定的编程经验但知识体系不够完整的读者也可以对照本书查缺补漏,从而更深入地理解程序的工作原理。本书最初是为北京亚嵌教育研究中心的嵌入式Linux系统工程师就业班课程量身定做的教材之一,也适合作为高等院校程序设计基础课程的教材。本书对于C语言的语法介绍得非常全面,对C99标准做了很多解读,因此也可以作为一本精简的C语言语法参考书。...
豆瓣成员常用的标签(共58个) · · · · · ·
喜欢读"Linux C编程一站式学习"的人也喜欢 · · · · · ·
按有用程度 按页码先后 最新笔记
-
12.3 深度优先搜索
/代码内容已省略/ (更多)/**************** 把3题一起做了: 1、正向打印路线 2、节省空间储存前驱点 3、改成递归 By LYLtim ****************/ #include<stdio.h> #include<stdlib.h> const char Di[4] = {0,1,0,-1}, Dj[4] = {1,0,-1,0}; char maze[5][5] = { 2, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0}, ip = 0; struct {char i, j;} path[23]; void print_maze(void) { char i, j; for (i = 0; i < 5; i++) { for (j = 0; j < 5; j++) printf("%hd ", maze[i][j]); putchar('\n'); } printf("*********\n"); } void print_path(void) { char i = 0; printf("(0,0)"); for (i = 0; i < ip; i++) printf("->(%hd,%hd)", path[i].i, path[i].j); exit(0); } void try(char i, char j) { char k; for (k = 0; k < 4; k++) { char Ni = i + Di[k], Nj = j + Dj[k]; if (Ni >= 0 && Ni <5 && Nj >= 0 && Nj < 5 && maze[Ni][Nj] == 0) { maze[Ni][Nj] = 2; path[ip++].i = Ni; path[ip].j = Nj; print_maze(); if (Ni == 4 && Nj == 4) print_path(); else try(Ni, Nj); maze[Ni][Nj] = 0; path[--ip].i = 0; path[ip].j = 0; } } } int main(void) { try(0, 0); return 0; }(收起)2011-10-15 10:50:43 回应
-
第11章 排序与查找 4. 归并排序
快速排序 /代码内容已省略/ (更多)快速排序/* By LYLtim */ #include<stdio.h> #define LEN 6 int a[LEN] = {4, 6, 0, 1, 2, 3}; void swap (int *a, int *b) { int t = *a; *a = *b; *b = t; } void QSort(int a[], int l, int r) { int pl = l, pr = r, key = a[(l+r)>>1]; while (pl < pr) { while (a[pl] < key) pl++; while (a[pr] > key) pr--; if (pl <= pr) { swap(&a[pl], &a[pr]); pl++; pr--; } } if (pl < r) QSort(a, pl, r); if (pr > l) QSort(a, l, pr); } void print(int a[]) { int i; for (i = 0; i < LEN-1; i++) printf("%d, ",a[i]); printf("%d\n",a[LEN-1]); } int main(void) { QSort(a, 0, LEN-1); print(a); return 0; }(收起)2011-08-12 21:28:24 回应
-
第 6 章 循环语句 5. 嵌套循环
习题 1、上面打印的小九九有一半数据是重复的,因为8*9和9*8的结果一样。请修改程序打印这样的小九九: 1 2 4 3 6 9 4 8 12 16 5 10 15 20 25 6 12 18 24 30 36 7 14 21 28 35 42 49 8 16 24 32 40 48 56 64 9 18 27 36 45 54 63 72 81 /代码内容已省略/ 2、编写函数diamond打印一个菱形。如果调用diamond(3, '*')则打印: * * * * * 如果调用dia... (更多)习题 1、上面打印的小九九有一半数据是重复的,因为8*9和9*8的结果一样。请修改程序打印这样的小九九: 1 2 4 3 6 9 4 8 12 16 5 10 15 20 25 6 12 18 24 30 36 7 14 21 28 35 42 49 8 16 24 32 40 48 56 64 9 18 27 36 45 54 63 72 81
#include<stdio.h> int main() { int i; for (i = 1; i <= 9; i++) { int j; for (j = 1; j <= i; j++) printf("%d ", i * j); printf("\n"); } return 0; }2、编写函数diamond打印一个菱形。如果调用diamond(3, '*')则打印: * * * * * 如果调用diamond(5, '+')则打印: + + + + + + + + + + + + + 如果用偶数做参数则打印错误提示。
/* 每一行的星号和空格的数量是纵坐标i的函数关系,由于图形关于横轴对称,因此字符的数量就和字符的纵坐标距离中间位置的距离有关,这个距离就是纵坐标减去中间位置纵坐标的绝对值。 By LYLtim */ #include<stdio.h> #include<math.h> void diamond(int n, char c) { int i; for (i = 1; i <= n; i++) { int d = abs(i - n / 2 - 1), j; for (j = 1; j <= d; j++) printf(" "); for (j = 1; j <= (n / 2 + 1 - d) * 2 - 1; j++) printf("%c", c); printf("\n"); } } int main() { int n; char c; printf("Input n,c:"); scanf("%d,%c", &n, &c); if (n % 2 == 0) printf("error\n"); else diamond(n, c); }(收起)2011-08-04 17:30:48 回应
-
第1页
Maiie (体验,思考,活着就是生活。)
这学期刚装的UBUNTU,既是LINUX新手,更是C语言小白,至今只写过几行HELLO WORLD!!昨晚刚下单在卓越买的这书,中午拿到翻了几下,概念很多,需要记的东西很多,所以决定做个笔记。本人记性比忘性好太多了,所以为防忘记做个读书笔记也个不错的选择。 (更多)这学期刚装的UBUNTU,既是LINUX新手,更是C语言小白,至今只写过几行HELLO WORLD!!昨晚刚下单在卓越买的这书,中午拿到翻了几下,概念很多,需要记的东西很多,所以决定做个笔记。本人记性比忘性好太多了,所以为防忘记做个读书笔记也个不错的选择。 (收起)2011-04-21 19:00:03 回应
-
第14页
Maiie (体验,思考,活着就是生活。)
这本书看得很慢,很多概念都是新的,还得慢慢理解,没办法啦,这方面的知识基本空白,刚刚看到怎样编译,$gcc main.c; ./a.out;-o选择自定义文件名,$gcc main.c -o name;输出可执行文件./name.out.加上-wall可以让gcc提供所有警告信息; #include <stdio.h>必须独占一行,int main(void)定义主函数,花括号中每句以“;”结尾,且最后以"return 0;"结束语句。//可以注释该行;“”可引字符串,而‘’只能.. (更多)这本书看得很慢,很多概念都是新的,还得慢慢理解,没办法啦,这方面的知识基本空白,刚刚看到怎样编译,$gcc main.c; ./a.out;-o选择自定义文件名,$gcc main.c -o name;输出可执行文件./name.out.加上-wall可以让gcc提供所有警告信息; #include <stdio.h>必须独占一行,int main(void)定义主函数,花括号中每句以“;”结尾,且最后以"return 0;"结束语句。//可以注释该行;“”可引字符串,而‘’只能引单个字符,特别的转义字符属单个字符,如下:\'u单引号;\"双引号;\?问号;\\反斜线,\a响铃;\b退格;\f分页符;\n换行;\r回车;\t水平制表符;\v垂直制表符; (收起)2011-04-22 23:03:02 1回应
-
第118页
费费 (ლ(╹◡╹ლ))
#include <stdio.h> #include <math.h> struct complex_struct{double x, y;}; double real_part(struct complex_struct z) { return z.x; } double img_part(struct complex_struct z) { return z.y; } double magnitude(struct complex_struct z) { return sqrt(z.x * z.x + z.y * z.y); } double angle(struct complex_struct z) { return atan2(z.y, z.x); } struct complex_struc... (更多)#include <stdio.h>#include <math.h>struct complex_struct{double x, y;};double real_part(struct complex_struct z){ return z.x;}double img_part(struct complex_struct z){ return z.y;}double magnitude(struct complex_struct z){ return sqrt(z.x * z.x + z.y * z.y);}double angle(struct complex_struct z){ return atan2(z.y, z.x);}struct complex_struct make_from_real_img(double x, double y){ struct complex_struct z;z.x = x;z.y = y;return z;}struct complex_struct make_from_mag_ang(double r, double A){ struct complex_struct z;z.x = r * cos(A);z.y = r * sin(A);return z;}struct complex_struct add_complex(struct complex_struct z1, struct complex_struct z2){ return make_from_real_img(real_part(z1) + real_part(z2), img_part(z1)+img_part(z2));}struct complex_struct sub_complex(struct complex_struct z1, struct complex_struct z2){ return make_from_real_img(real_part(z1)-real_part(z2), img_part(z1)-img_part(z2));}struct complex_struct mul_complex(struct complex_struct z1, struct complex_struct z2){ return make_from_mag_ang(magnitude(z1)*magnitude(z2), angle(z1)+angle(z2));}struct complex_struct div_complex(struct complex_struct z1, struct complex_struct z2){ return make_from_mag_ang(magnitude(z1)/magnitude(z2), angle(z1)-angle(z2));}int main(void){ struct complex_struct z1 ={3.0, 4.0};struct complex_struct z2 ={1.8, 2.5};printf("z1+z2=%f+%fi\n", real_part(add_complex(z1,z2)), img_part(add_complex(z1,z2)));printf("z1-z2=%f-%fi\n", real_part(sub_complex(z1,z2)), img_part(sub_complex(z1,z2)));printf("z1*z2=%f*%fi\n", real_part(mul_complex(z1,z2)), img_part(mul_complex(z1,z2)));printf("z1/z2=%f/%fi\n", real_part(div_complex(z1,z2)), img_part(div_complex(z1,z2)));return 0;} (收起)2011-06-28 23:02:45 回应
-
12.3 深度优先搜索
/代码内容已省略/ (更多)/**************** 把3题一起做了: 1、正向打印路线 2、节省空间储存前驱点 3、改成递归 By LYLtim ****************/ #include<stdio.h> #include<stdlib.h> const char Di[4] = {0,1,0,-1}, Dj[4] = {1,0,-1,0}; char maze[5][5] = { 2, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0}, ip = 0; struct {char i, j;} path[23]; void print_maze(void) { char i, j; for (i = 0; i < 5; i++) { for (j = 0; j < 5; j++) printf("%hd ", maze[i][j]); putchar('\n'); } printf("*********\n"); } void print_path(void) { char i = 0; printf("(0,0)"); for (i = 0; i < ip; i++) printf("->(%hd,%hd)", path[i].i, path[i].j); exit(0); } void try(char i, char j) { char k; for (k = 0; k < 4; k++) { char Ni = i + Di[k], Nj = j + Dj[k]; if (Ni >= 0 && Ni <5 && Nj >= 0 && Nj < 5 && maze[Ni][Nj] == 0) { maze[Ni][Nj] = 2; path[ip++].i = Ni; path[ip].j = Nj; print_maze(); if (Ni == 4 && Nj == 4) print_path(); else try(Ni, Nj); maze[Ni][Nj] = 0; path[--ip].i = 0; path[ip].j = 0; } } } int main(void) { try(0, 0); return 0; }(收起)2011-10-15 10:50:43 回应
-
第11章 排序与查找 4. 归并排序
快速排序 /代码内容已省略/ (更多)快速排序/* By LYLtim */ #include<stdio.h> #define LEN 6 int a[LEN] = {4, 6, 0, 1, 2, 3}; void swap (int *a, int *b) { int t = *a; *a = *b; *b = t; } void QSort(int a[], int l, int r) { int pl = l, pr = r, key = a[(l+r)>>1]; while (pl < pr) { while (a[pl] < key) pl++; while (a[pr] > key) pr--; if (pl <= pr) { swap(&a[pl], &a[pr]); pl++; pr--; } } if (pl < r) QSort(a, pl, r); if (pr > l) QSort(a, l, pr); } void print(int a[]) { int i; for (i = 0; i < LEN-1; i++) printf("%d, ",a[i]); printf("%d\n",a[LEN-1]); } int main(void) { QSort(a, 0, LEN-1); print(a); return 0; }(收起)2011-08-12 21:28:24 回应
-
第 6 章 循环语句 5. 嵌套循环
习题 1、上面打印的小九九有一半数据是重复的,因为8*9和9*8的结果一样。请修改程序打印这样的小九九: 1 2 4 3 6 9 4 8 12 16 5 10 15 20 25 6 12 18 24 30 36 7 14 21 28 35 42 49 8 16 24 32 40 48 56 64 9 18 27 36 45 54 63 72 81 /代码内容已省略/ 2、编写函数diamond打印一个菱形。如果调用diamond(3, '*')则打印: * * * * * 如果调用dia... (更多)习题 1、上面打印的小九九有一半数据是重复的,因为8*9和9*8的结果一样。请修改程序打印这样的小九九: 1 2 4 3 6 9 4 8 12 16 5 10 15 20 25 6 12 18 24 30 36 7 14 21 28 35 42 49 8 16 24 32 40 48 56 64 9 18 27 36 45 54 63 72 81
#include<stdio.h> int main() { int i; for (i = 1; i <= 9; i++) { int j; for (j = 1; j <= i; j++) printf("%d ", i * j); printf("\n"); } return 0; }2、编写函数diamond打印一个菱形。如果调用diamond(3, '*')则打印: * * * * * 如果调用diamond(5, '+')则打印: + + + + + + + + + + + + + 如果用偶数做参数则打印错误提示。
/* 每一行的星号和空格的数量是纵坐标i的函数关系,由于图形关于横轴对称,因此字符的数量就和字符的纵坐标距离中间位置的距离有关,这个距离就是纵坐标减去中间位置纵坐标的绝对值。 By LYLtim */ #include<stdio.h> #include<math.h> void diamond(int n, char c) { int i; for (i = 1; i <= n; i++) { int d = abs(i - n / 2 - 1), j; for (j = 1; j <= d; j++) printf(" "); for (j = 1; j <= (n / 2 + 1 - d) * 2 - 1; j++) printf("%c", c); printf("\n"); } } int main() { int n; char c; printf("Input n,c:"); scanf("%d,%c", &n, &c); if (n % 2 == 0) printf("error\n"); else diamond(n, c); }(收起)2011-08-04 17:30:48 回应
书评 · · · · · · (共14条) 我来评论这本书
热门评论 最新评论
第一次写书评,感觉这书写得不错
-
- wrongway 在看陈儒的《Python源码剖析》时,遇到了一些C的问题,看了几本C的书,还是不得其解。后来看到车东在博客中推荐这本书的网络版(据说是作者出版前放出来让网友修正的,http://learn.akae.cn/media/index.html),我看了一下,解决了不少疑惑,至少对字符串和整型,长整型,正整型之间的转换和限制...... (3回应)2009-12-16 22/22有用
摘录一下新版序言
-
- 阿呆(长恨此身非我有) 此书第一版读到一半,已被作者细心严谨的态度所折服。 我手中的书写着第一版第一次印刷,4000册。按此估计,作者的稿费不足2万(恐怕还是分期付的)。相对于作者投入的精力,写本好的技术书,真可以算是做慈善了。 国内技术书籍的现状令人伤心,卖的最多的,恰是质量最烂的那些教材。 因此对于国内好的技术书籍,要更加鼓励,希望...... (4回应)2011-04-19 11/11有用来自 电子工业出版社2011版
宋劲杉老师真是一朵奇葩
-
- cyker(http://www.cykerway.com) 此书内容涵盖极广:C的基本语法,简单的数据结构,C与汇编的联系,计算机系统结构,操作系统,正则表达式,TCP/IP,无所不包。 如此一来似乎样样通而样样不精。其实不是这么回事。作者内容穿插得非常好,用十分简单的方式把每个方面最重要的东西阐明了。 所以,其实这是本入门书,当然也适合各个方面都了解之后总结用。看......2011-01-15 12/12有用
计算机人的指路灯
-
- laciqs 大多数大学生都会遇到一个问题:学习C语言到底有什么用?其实这实在是一个让人无奈的问题,如果学习一样东西不知道用来做什么,那么还有什么好学的?又怎么能学好?这不能不让人感慨现今的填鸭式教育。 其实不光C语言,像计算机体系结构、操作系统、编译原理这些实实在在的内功也遭受到不少学生的质疑,同时这个所谓新潮技术满天飞的年代更......2011-11-23 2/2有用来自 电子工业出版社2011版
这本书确实不错,因为没有停留在语法层面
-
- xdgj 这本书确实不错,因为没有停留在语法层面。书中剖析了很多c语言低层的东西,读完以后,理解更深刻,更细致了。书的结构也是由浅入深的,比一些纯粹讲语法的书好多了。当然,建议有一定c语言以及操作系统基础的人看。......2011-12-15
挺适合C语言入门和初步学习
-
- billryan 作者功力深厚,能把C语言相关的那么多东西写在一本书里边而且又穿插合理,使初学者也较容易接受。文字读起来轻松而又不乏一些思想级层次的东西,不像国内大多数写书的人对读者不负责任,作者写这本书是很认真负责的,总之力荐。......2011-12-10
"Linux C编程一站式学习"的论坛 · · · · · ·
| 入门不错 | 来自逆飞的鱼 | 2010-01-26 | |
| 封面想学O'Reilly,但是书名暴漏了 | 来自[已注销] | 26 回应 | 2011-06-16 |
| 对国内技术书籍的看法从此改观 | 来自ndv | 6 回应 | 2010-06-16 |
| 封面确实很好啊 | 来自rIPPER色影师 | 2 回应 | 2010-10-18 |
| 国内开源书籍无出其右 | 来自秋雨 | 1 回应 | 2011-06-11 |
> 浏览更多话题
这本书的其他版本 · · · · · · ( 全部2 )
- 电子工业出版社版 2011-3 / 21人读过 / 有售
以下豆列推荐 · · · · · · (全部)
- C语言书籍 (sagasw)
- 数学计算机专业书籍 (我叫点点点)
- 我策划的书 (冰冰子)
- C语言学习之路 (逆飞的鱼)
- 2011 书单(CS学习) (催眠)
谁读这本书?
喜欢这本书的人常去的小组 · · · · · ·

- O'Reilly爱好者 (2806)

- 分布式技术与系统软件 (679)

- Vim (6205)

- Linux Kernel 学习 (711)

- git (774)

- linux系统编程学习小组 (882)

- Django (3835)

- ubuntu (5522)
喜欢这本书的人关注的活动 · · · · · ·
订阅关于Linux C编程一站式学习的评论:
feed: rss 2.0











