That's right, I learned to program in C++, and of course know the common set of features of both languages, so I can program in C.
But I'd really like to read tutorials or books that teach you C, and the C way of programming, from a C++ programmer's perspective.
|
|
|
I think the best way to get started is to go through Kernighan & Ritchie's "The C Programming Language". It's a reference book for C's features and syntax, but pretty much all the examples and sample programs included are very elegant and illustrate the "C way of doing things". Amazon link: http://www.amazon.com/Programming-Language-2nd-Brian-Kernighan/dp/0131103628 Another good resource you might wanna check is http://c-faq.com/. It answers most of the common questions about the language. After that you just need to take a look at some C programs and write a couple on your own, preferably playing with the trickier parts of the language (i.e., pointers, pointers to functions, memory allocation, etc.). |
|||||||||||||
|
|
Speaking as someone who uses C++ every day, but has had to do a fair chunk of C work... Don't forget what you learnt in C++. You can still do good object oriented design in pure C, you just need to do things a little differently. I found that sitting down with one of the C libraries that I'd integrated into a C++ application and reading through its source code (rather than just the headers) was really helpful. Though you need to find a well implemented library. I particularly learnt a lot from lua, freetype2 and libxml2.. but there's heaps of good libraries out there. (Also heaps of bad ones... so if it looks badly engineered, dump it and move on). |
|||
|
|
|
Becoming C++ programmer from C quiet difficult, but the other way round is not so difficult. This is my personal experiance, as i turned a C++ programmer from C. K&R is a great book, the best book i have ever read. I still find it interesting. Advanced Programming in the UNIX Environment, 2nd edition, another great book. But let me tell you, you will not find useful features like class, exception handling, template etc. But you should always keep them in mind even if you will be in C, as some of them can be achieved with some extra effort. |
||||
|
|
there are ways to synthesize a lot of C++ features in C. even though you may not actually want to do this, I found it highly educational. Check out the C++ FQA (literally FQA, not FAQ ) by an anti-C++ curmudgeon ( a highly intelligent one at that!). He talks about foward-declaring functions that accept structures in C, then linking to their implementation later on. This is similar to the idea of C++ polymorphism. You can learn alot about something by seeing its equivalence to other things. |
|||||||||||||
|