学习C

Date: Thurs, May 10 2007 7:55 am
From: Richard Heathfield

weidongtom@gmail.com said:

> Hi,
>
> I have just finished reading some tutorials on C, I am wondering how I
> could improve my skill. Is there any advice? Is reading others' codes
> the best way?

Crank up the warning level of your compiler as high as it will go, and
write lots and lots of programs. Remember that much of what your
tutorials taught you is likely to be wrong. Most C tutorials are
written by people who don't know C. Come to think of it, so is most C
code. So, whilst "reading others' code" can be helpful, get into the
habit of thinking "why is this code bad? What don't I like about it?
What diagnostic messages does it cause my compiler to emit? Do I
understand those messages? What don't I understand about the code
itself? *WHY* is the author doing such-and-such?"

> I have been reading quite a few
> books on the programming language C, but when I tried to start a
> project of my own, I find myself to be incompetent.

Honesty will get you everywhere! :-) Seriously, true competence (in
*any* field worth pursuing) takes about ten years of diligent study and
*practice*. Ten years to be a competent doctor, lawyer, programmer,
whatever.

Devise a project of your very own - e.g. a simple text processor - and define N things you'd like it to do (where N is initially at least 4). Implement those features, one at a time, learning all about diagnostic messages as you go! When you've implemented all N features, think up another N/4 features (rounded down), and notice how awkward it is to fit them in. Re-factor the code to make adding the new features much more pleasant, and now you're starting to learn about programming. Once all 5N/4 features are implemented, let N = 5N/4 and go round again, until you start to hit practical limits. This is feature creep with a vengeance! But it will introduce you gently to large programs.

> What should I do?

Write C programs.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值