tags:

views:

307

answers:

10

Does anyone know any good resources with tasks or problems to get practice in things that are "new" in C from the point of view of someone with experience in high-level languages like C# and PHP? All I can seem to find are more "challenges" than problems for practice.

Thanks.

+12  A: 

K & R. [Kernighan & Ritchie]

http://www.amazon.com/Programming-Language-Prentice-Hall-Software/dp/0131103628/ref=pd_bbs_1?ie=UTF8&s=books&qid=1240539543&sr=8-1

Genericrich
+1. That's exactly what I was going to say. :)
htw
Anyone know if there are any plans to produce a third edition?
dmckee
dmckee
@mmw: The OP specifically asked for something that would be suitable for one is new to C, but who *already* has experience with high-level languages.
htw
AnnaR
RBerteig
RBerteig
Dead account
A: 

This supposed to be C bible.

J.W.
@mmw: the OP isn't asking for a beginners book, but an intro to C.
xan
+5  A: 

You could try Thinking in C by Bruce Eckel.

It is completely free of charge, and is available for download from his website.

Tian Bo
A: 

Problem Solving and Program Design in C

by

Jeri R. Hanly, Elliot B. Koffmon and Frank L. Friedman

Dan Adams
+3  A: 

As others have said, read K&R.

Pay special attention to pointers, structs, unions, bit fields, typedefs, and the C preprocessor. Pointers and pointer arithmetic are very important.

Read the C preprocessor manual.

Learn to write makefiles. Read the manual for your version of make.

daotoad
+1 Makefiles are essential. Autotools are also a great idea, but almost more trouble than they're worth if you have no plans to distribute you work widely.
Chris Lutz
A: 

K&R is outdated.

I prefer C Primer Plus 5th Ed by Stephen Prata ISBN: 0-672-32696-5

It covers C99.

Hideo
GCC has good C99 support, but it's not complete, and few other compilers even try for C99. Also, a lot of people will use a C++ compiler, and then what is C99 support worth? I generally code in C89 for assured portability. It's better (in my humble opinion) to learn C as C89, and when you know that find all the cool new goodies in C99 because, despite having been made 10 years ago, they still feel cool and new (and are still not all implemented).
Chris Lutz
I don't use C++. I use solely C, so it matters to me. ;) I also use assembly language.
Hideo
A: 

Check out The Standard C Library by P. J. Plauger, from 1991. It alternates quotes from the standard (C89, I believe) with discussion of how the library functions were intended to be used, along with a fully described implementation of the complete C standard library. Source code is included as well.

Yes, the book hasn't been updated for the latest standard, but it still has a lot of value from explaining at least some of the rationale behind some of the oddities of the standard library. Incidentally, Plauger was on the standards committee.

Plauger wrote a number of the classic books on both C and early Unix. Track down and read the oldest for a taste of pre-C history...

RBerteig
A: 

Given your previous (C#) programming experience I guess you don't need a book that teaches how to program but the intricacies and subtleties of C. I'd recommend the following:

  • Prentice Hall - The ANSI C Programming Language 2nd ed. by Brian W. Kernighan and Dennis M. Ritchie. For basic questions.
  • Prentice Hall - Expert C Programming. Deep C Secrets.
  • ISO - C 99 Standard - final. Very useful for many doubts and questions
piotr
A: 

A source of problems to solve that have known answers is Project Euler.

It isn't itself C specific since there is a decidedly mathematical orientation to the problems as presented. However, making an honest attempt to solve a significant number of them would require a growing proficiency with structures, pointers, the standard library, and thinking about things in ways that work well in C.

Another resource that often seems to be overlooked is that MIT has been putting a large percentage of their curriculum online. Their EE/CS department is no exception. The class Introduction to Algorithms might be one suitable choice. The textbook is Introduction to Algorithms, Second Edition, by Cormen, Leiserson, Rivest, and Stein which is reasonably well written as text books go. I didn't exhaustively search the course list, so I'm sure there are other gems in there as well.

RBerteig