Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > How to improve C skill?

Reply
Thread Tools

How to improve C skill?

 
 
weidongtom@gmail.com
Guest
Posts: n/a
 
      05-10-2007
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? If so, what type of codes are suitable for novice? The
ones in fsf freed software directory? 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. What should I do?
Thanks in advance.

 
Reply With Quote
 
 
 
 
Ian Collins
Guest
Posts: n/a
 
      05-10-2007
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> Hi,
>
> I have just finished reading some tutorials on C, I am wondering how I
> could improve my skill. Is there any advice?


Plenty!

> Is reading others' codes
> the best way? If so, what type of codes are suitable for novice?


Code in this context is singular ("code" rather than "codes"). Just
reading code probably isn't a good idea. Reading source to see how
something you know works is more effective.

Try the exercises in K&R, there have been plenty of solutions posted
here to look through if you get stuck.

> 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. What should I do?


Start simple!

--
Ian Collins.
 
Reply With Quote
 
 
 
 
Malcolm McLean
Guest
Posts: n/a
 
      05-10-2007

<(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ps.com...
> 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? If so, what type of codes are suitable for novice? The
> ones in fsf freed software directory? 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. What should I do?
> Thanks in advance.
>

Try writing "asteroids".
This is a game in which you manoevre a spacship between lines of asterisks,
which scroll down the console. You will need curses / conio or other
non-standard header to treat the console correctly.
It is very easy to write and will give you a sense of achievement. It you
put in levels and scores you can make quite a sophisticated game.
Start by making sure you can use your console library to position characters
at will.
--
Free games and programming goodies.
http://www.personal.leeds.ac.uk/~bgy1mm

 
Reply With Quote
 
Richard Heathfield
Guest
Posts: n/a
 
      05-10-2007
(E-Mail Removed) 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.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.
 
Reply With Quote
 
jaysome
Guest
Posts: n/a
 
      05-10-2007
On 9 May 2007 19:57:02 -0700, "(E-Mail Removed)"
<(E-Mail Removed)> wrote:

>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? If so, what type of codes are suitable for novice? The
>ones in fsf freed software directory? 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. What should I do?
>Thanks in advance.


Buy the book "C Programming FAQs: Frequently Asked Questions", and
read it cover to cover. This book is written by Steve Summit, who
wrote the FAQ for this newsgroup. The book is available on amazon.com:

http://www.amazon.com/Programming-FA.../dp/0201845199

Additionally, continue to read this newsgroup. There are some really
sharp people who post here, and if you lurk around here for a
reasonable amount of time, you should be able to determine who these
people are, and learn a lot from them.

Also, get yourself a cheap PC ($100 U.S.) at a garage sell or on your
local classifieds and install a free Linux distribution like Ubuntu:

http://www.ubuntu.com/

Linux distributions will provide you with the gcc compiler, which is
arguably one of the best available, free or not. Just make sure to
write a lot of programs and crank up the compiler warning level. For
example, with gcc, this is a good start:

gcc -Wall -W -ansi -pedantic

Finally, if you have any questions about standard C, don't hesitate to
ask in this newsgroup.

Best regards
--
jay
 
Reply With Quote
 
Laurent Deniau
Guest
Posts: n/a
 
      05-10-2007
jaysome wrote:
> On 9 May 2007 19:57:02 -0700, "(E-Mail Removed)"
> <(E-Mail Removed)> wrote:
>
>> 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? If so, what type of codes are suitable for novice? The
>> ones in fsf freed software directory? 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. What should I do?
>> Thanks in advance.

>
> Buy the book "C Programming FAQs: Frequently Asked Questions", and
> read it cover to cover. This book is written by Steve Summit, who
> wrote the FAQ for this newsgroup. The book is available on amazon.com:
>
> http://www.amazon.com/Programming-FA.../dp/0201845199
>
> Additionally, continue to read this newsgroup. There are some really
> sharp people who post here, and if you lurk around here for a
> reasonable amount of time, you should be able to determine who these
> people are, and learn a lot from them.
>
> Also, get yourself a cheap PC ($100 U.S.) at a garage sell or on your
> local classifieds and install a free Linux distribution like Ubuntu:
>
> http://www.ubuntu.com/
>
> Linux distributions will provide you with the gcc compiler, which is
> arguably one of the best available, free or not. Just make sure to
> write a lot of programs and crank up the compiler warning level. For
> example, with gcc, this is a good start:
>
> gcc -Wall -W -ansi -pedantic


Since beginners are often satisfied when the compilation ends without
errors but with many warnings, I would add -Werror

a+, ld.
 
Reply With Quote
 
Pietro Cerutti
Guest
Posts: n/a
 
      05-10-2007
jaysome wrote:
> On 9 May 2007 19:57:02 -0700, "(E-Mail Removed)"
> <(E-Mail Removed)> wrote:
>
>> 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? If so, what type of codes are suitable for novice? The
>> ones in fsf freed software directory? 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. What should I do?
>> Thanks in advance.

>
> Buy the book "C Programming FAQs: Frequently Asked Questions", and
> read it cover to cover. This book is written by Steve Summit, who
> wrote the FAQ for this newsgroup. The book is available on amazon.com:
>
> http://www.amazon.com/Programming-FA.../dp/0201845199
>
> Additionally, continue to read this newsgroup. There are some really
> sharp people who post here, and if you lurk around here for a
> reasonable amount of time, you should be able to determine who these
> people are, and learn a lot from them.
>
> Also, get yourself a cheap PC ($100 U.S.) at a garage sell or on your
> local classifieds and install a free Linux distribution like Ubuntu:
>
> http://www.ubuntu.com/
>
> Linux distributions will provide you with the gcc compiler, which is
> arguably one of the best available, free or not. Just make sure to
> write a lot of programs and crank up the compiler warning level. For
> example, with gcc, this is a good start:
>
> gcc -Wall -W -ansi -pedantic

Why would you use -ansi instead of -c99?

>
> Finally, if you have any questions about standard C, don't hesitate to
> ask in this newsgroup.
>
> Best regards



--
Pietro Cerutti

PGP Public Key ID:
http://gahr.ch/pgp
 
Reply With Quote
 
Richard Heathfield
Guest
Posts: n/a
 
      05-10-2007
Pietro Cerutti said:

> jaysome wrote:


<snip>

>> Just make sure to
>> write a lot of programs and crank up the compiler warning level. For
>> example, with gcc, this is a good start:
>>
>> gcc -Wall -W -ansi -pedantic

> Why would you use -ansi instead of -c99?


Most compilers don't conform to C99 (including gcc, despite the switch).

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.
 
Reply With Quote
 
Pietro Cerutti
Guest
Posts: n/a
 
      05-10-2007
Richard Heathfield wrote:
> Pietro Cerutti said:
>
>> jaysome wrote:

>
> <snip>
>
>>> Just make sure to
>>> write a lot of programs and crank up the compiler warning level. For
>>> example, with gcc, this is a good start:
>>>
>>> gcc -Wall -W -ansi -pedantic

>> Why would you use -ansi instead of -c99?

>
> Most compilers don't conform to C99 (including gcc, despite the switch).


Yes, I know. But still, I don't see the point to completely avoid C99
features just because some of them are not implemented (yet).
The "Status of C99 features in GCC" [1] explicitly says what you can use
safely and what you can't.
So why not start using the useful features which we have at disposal
now, and wait for the remaining ones to come, instead of just snobbing
the whole C99 set of changes?

[1] http://gcc.gnu.org/c99status.html

--
Pietro Cerutti

PGP Public Key ID:
http://gahr.ch/pgp
 
Reply With Quote
 
Richard Heathfield
Guest
Posts: n/a
 
      05-10-2007
Pietro Cerutti said:

> Richard Heathfield wrote:
>> Pietro Cerutti said:
>>
>>> jaysome wrote:

>>
>> <snip>
>>
>>>> Just make sure to
>>>> write a lot of programs and crank up the compiler warning level.
>>>> For example, with gcc, this is a good start:
>>>>
>>>> gcc -Wall -W -ansi -pedantic
>>> Why would you use -ansi instead of -c99?

>>
>> Most compilers don't conform to C99 (including gcc, despite the
>> switch).

>
> Yes, I know. But still, I don't see the point to completely avoid C99
> features just because some of them are not implemented (yet).


It depends on your requirements.

If you are only using one compiler, ever, and don't need your code to
work with any other compiler, there is no point even in sticking to
C99. You can use any feature of the implementation that you like!

But if your code has to work with many implementations (i.e. more than
one), it may be necessary to restrict yourself to the features that are
available in all your implementations. And, in some cases, you do not
know at the time of writing the code which implementation(s) it will
eventually be required to work with. In such cases, it makes sense to
write code that conforms to the common subset of C90 and C99.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
How to quickly improve your computer's performance @ Bona... Silverstrand Front Page News 0 08-24-2005 01:26 PM
How to improve the image quality of crystal report in asp.net? Simon Peng ASP .Net 1 07-22-2004 05:10 AM
MCSE: Is it now a SCAM? +Suggestion to improve it Mike MCSE 20 12-04-2003 09:27 PM
How to improve the asp.net application's performance? hb ASP .Net 2 11-25-2003 10:35 PM



Advertisments