Some one asked a question for studying C programming language on stackexachange.com. He got a bucket of recommanded project, which I reformed here.

Reimplementing the famous library

1. the c standard library.

string.h

memchr, memcmp, memcpy, memmove, memset, strcat, strncat, strchr, strcmp, strncmp, strcoll, strcpy, strncpy, strcspn, strerror, strlen, strpbrk, strrchr, strspn, strstr, strtok, strxfrm

stdlib.h

abs, div, labs, ldiv, atof, atoi, atol, strtod, strol, bsearch, qsort

time.h

asctime, difftime

More advanced task would be to reimplement printf.

2.you have to parse a XML file at work using Java, then at home you can try rewrite the parser in C/C++.

One week homeworks or toys

  • Implement all your favorite data structures: linked list, binary search tree, binary heap, chained hash, quadratic probing hash, etc. Build a string->string dictionary as an RB tree, a treap, and a hash.
  • Write a memory allocator. Get eg a big 16mb chunk from the operating system, then write your own versions of malloc() and free() that work entirely inside that. Make sure it can handle allocations of arbitrary sizes -- not just char and int, but strings and structs. Boundary tag allocation is probably easiest. For bonus points, use this malloc() for the assignments above, to make sure it really works.
  • Count the number of occurrences of each word in the collected works of William Shakespeare. Provide functions to print these sorted in alphabetical order or by count.
  • Here is libtiff. Write a program that shrinks an input image to half its size.
  • Write your own toy filesystem. Get a big 1gb file from the OS, pretend that is a blank disk and that you are the operating system, and then write your own fopen(), fwrite(), etc.
  • Only one worth adding would be something along the lines of implementing a basic TCP stack over UDP. Since you did not hit anything networking
  • Write a raytracer. Might be a bit time-intensive, but you can choose which more advanced techniques to implement on your leisure, plus the results are eye candy if you put some work into it.
  • You could also implement a image or data (de)compression algorithm. It's fun, there is lot of bit twidling, pointers, trees, recursion, mathematics and place for optimizations.
  • Try to make a peer to peer software... We had this as an assignement, it's fun and you'll learn tons of things with it.
  • Try writing a small lambda calculus evaluator. Initially just malloc all you memory, and don't freeanything. Later, try writing your own memorypool with a small (mark-and-sweep) garbage collector.
  • some game without GUI. 1. Address book. No gui just text. Link lists. Learned memory and sorting; 2. Fractals. Learned math mostly but good test for ADT; 3. Solitaire game. Again no gui just text; 4. Also did a black jack game.

Reimplement a old software:

I recommend that you try to write a line-oriented text-editor akin to the old MS-DOS "EDLIN" program.

See http://en.wikipedia.org/wiki/Edlin for a description of EDLIN

Online judge practices and puzzles

Facebook Puzzles

Dropbox Puzzles

Reddit Puzzle: http://blog.reddit.com/2010/08/reddit-is-hiring.html

I have not looked into this yet, but UVA Online Judge has problems and I have heard as a recommended source for something like this: http://uva.onlinejudge.org/

Try http://projecteuler.net, they have many nice problems.

You could also try playing with bits: http://graphics.stanford.edu/~seander/bithacks.html.

Hacking into some real system

The Ruby interpreter is quite a fun project to work on, actually - there's a surprising amount of both low-level and linguistic hackery that goes on in there.

Skim the Linux source code, the FreeBSD source code, the OpenBSD source code, or the LibUSB source code.Find something that grabs your "Hey, I can do better than that! reflex." DO better than that!(LibUSB needs the ability to talk to devices, like My HP All-In-One, that used an outgrowth of the Parallel Port standards that were ported to USB.)

Read and done the exercises of the book.

1.The C Programming Language by Brian W. Kernighan, Dennis M. Ritchie

Keep a copy of K&R by your side, but find something real to work on.

Buy the K&R book, do the exercises. You'll (re)learn all you need about C, and a lot about CS too. Skip to the later chapters for parsing and Unixy goodness.

2.For helpful issue and tips: C Traps and Pitfalls by Andrew Koenig

3.working through code in C Interfaces and Implementations book.

4.On the other hand, if you are interested in system programming (e.g., to understand how to talk with the OS directly), there are tons of books and projects. I would recommend Unix Programming Environment,Advanced Programming in the UNIX Environment and UNIX Systems Programming: Communication, Concurrency and Threads.

5.How to implement a simple RMDB: according to this article.

So many good projects for studying C programming lanuage.的更多相关文章

  1. 重读The C programming Lanuage 笔记四:c预处理

    C预处理器执行宏替换.条件编译以及包含指定的文件.以#开头的命令行就是与处理器的对象.这些命令行的语法独立于语言的其他部分,它们可以出现在任何地方,其作用可延续到所在编译单元的末尾(与作用域无关).行 ...

  2. 重读The C programming Lanuage 笔记三:简单计算器程序

    //简单计算器 #include <stdio.h> #include <stdlib.h> #include <ctype.h> #include <str ...

  3. 重读The C programming Lanuage 笔记二:运算符优先级

    运算符的优先级和结合性有明确的规定,但是,除少数例外情况外,表达式的求值次序没有定义,甚至某些有副作用的子表达式也没有定义. 也就是说运算符的定义保证了其操作数按某一特定的顺序求值,否则具体实现可以自 ...

  4. 重读The C programming Lanuage 笔记一:类型转换

    首先说自动类型转换: 当一个运算符的几个操作数类型不同时,就需要吧他们转换位某种共同的类型.一般来说,自动转换把“较低”的类型转换为”较高“的类型.运算结果为较高的类型 以下是不严格的规则: 首先,如 ...

  5. (转)Awesome Courses

    Awesome Courses  Introduction There is a lot of hidden treasure lying within university pages scatte ...

  6. GPU端到端目标检测YOLOV3全过程(上)

    GPU端到端目标检测YOLOV3全过程(上) Basic Parameters: Video: mp4, webM, avi Picture: jpg, png, gif, bmp Text: doc ...

  7. Teach Yourself Programming in Ten Years

    Teach Yourself Programming in Ten Years——用十年教会自己编程 作者:Peter Norvig 译者:刘海粟 本文原文为:http://norvig.com/21 ...

  8.  Go is more about software engineering than programming language research.

    https://talks.golang.org/2012/splash.article Go at Google: Language Design in the Service of Softwar ...

  9. Programming Learning - Based on Project

    Today when taking a bath I got a good idea that it is an efficient and interesting way to learn a ne ...

随机推荐

  1. matlab注释使用,以及相应的注释快捷键

    1.多行注释 单行注释是加% %{ 若干语句 %} 2.快捷键 多行注释: 选中要注释的若干语句, 编辑器菜单Text-<Comment, 或者快捷键Ctrl+R 取消注释: 选中要取消注释的语 ...

  2. dede 5.7进后台卡死解决办法

    注释后台文件dede/templets/index_body.htm(大概在第18行) <script type="text/javascript"> function ...

  3. 深入理解require/include的顺序

    在大型的Web项目中, include_path是一个模块化设计的根本中的根本(当然,现在也有很多基于autoload的设计, 这个不影响本文的探讨), 但是正是因为include_path, 经常会 ...

  4. HttpWebRequest模拟c#网站登录

     用户名 密码 模拟登录asp.net开发的网站 关心两个问题:通过控件属性获取数据.响应事件. 上面是一个普通的asp.net表单.输入用户名.密码后,点击按钮将会进入各自绑定的后台函数,而不仅仅是 ...

  5. oracle 查询最近执行过的 SQL语句

    oracle 查询最近执行过的 SQL语句 select sql_text,last_load_time from v$sql order by last_load_time desc;   SELE ...

  6. ios 页面传值4种方式(一) 之全局变量

    通用的是用代理的方式实现页面传值,但是有时候利用其它方式也可以很巧妙的解决问题,页面传值一共有4种方式: 1.使用全局变量, SharedApplication,定义一个变量来传递. 2.使用文件,或 ...

  7. [禅悟人生]"执著"是自缚的茧

    宋代苏东坡和佛印禅师是好朋友,他们习惯拿对方开玩笑.有一天,苏东坡到金山寺和佛印禅师打坐参禅,苏东坡觉得身心通畅,于是问禅师道:“禅师!你看我坐的样子怎么样?” “好庄严,像一尊佛!” 苏东坡听了非常 ...

  8. [再寄小读者之数学篇](2014-11-19 $\sin x/x$ 在 $(0,\pi/2)$ 上递增)

    $$\bex \frac{\sin x}{x}\nearrow. \eex$$ Ref. [Proof Without Words: Monotonicity of $\sin x/x$ on $(0 ...

  9. MySQL定期分析检查与优化表

    定期分析表   ANALYZE [LOCAL | NO_WRITE_TO_BINLOG] TABLE tbl_name [, tbl_name]   本语句用于分析和存储表的关键字分布.在分析期间,使 ...

  10. Android 自定义dialogfragment

    在用dialogfragment的时候我们可能会不喜欢系统自带的黑色边框,那怎么办呢? dialofragment提供可供修改样式的方法setStyle(style,R.style.MyTryUseD ...