Learning C - Page 1
Forum section: electronics / general

author: Setar2k11
author_rank: Contributor
timestamp: April 20, 2012, 12:25:23 pm
content: Hi could anyone recommend me some books on learning C. I have a reasonable understanding of assembler, but want to start to learn C. So far i have used some of the baseline PICs and the mid-range PICs. I have had a look on amazon but there so many to choose from, hoping someone could recommend some decent books. I would prefer a book to on-line tutorials as i prefer to have a book to refer to rather than reading off the internet.

author: yanir
author_rank: Regular Contributor
timestamp: April 20, 2012, 12:47:58 pm
content: C Programming Language (2nd Edition) Brian W. Kernighan (Author), Dennis M. Ritchie (Author)This is the gold standard book on the topic. Written by the actual developers of C. Unfortunately you will find some differences when programming on a pic, the libraries are a little different. But the data structures are all the same.Being largely self taught with a few courses in c in college, i want to get this book as well to brush up on things I don't use very often like structs and type defs.Another option:Programming 16-Bit PIC Microcontrollers in C, Second Edition: Learning to Fly the PIC 24 Lucio Di Jasio (Author)I program pic parts in c (pic24 line). you will find some frustrating idiosyncrasies when trying to uses some standards taught in any book. I read through "programming 16 bit micro controllers in c" and it gives you a good general overview with some fun example projects"yanir

author: MikeK
author_rank: Super Contributor
timestamp: April 20, 2012, 02:41:27 pm
content: If you've never programmed in C, then do as yanir says, get the K&R book. Although it's for computer programming, it will give you a solid understanding of the language, with nearly all of it carrying over to microcontroller programming. It's a great book, there are even exercises in it to build your understanding. There are probably a bunch of free C compilers (for the PC) that you can use to practice with.Then, there are a bunch of PIC tutorials in C here:http://www.gooligum.com.au/tutorials.html

author: Setar2k11
author_rank: Contributor
timestamp: April 20, 2012, 04:52:53 pm
content: Thank you, i have already come across the gooligum tutorials, an excellent website.

author: A-sic Enginerd
author_rank: Regular Contributor
timestamp: April 20, 2012, 10:46:23 pm
content: In addition to K&R, this one comes highly recommended.http://www.amazon.com/C-Primer-Plus-5th-Edition/dp/0672326965/ref=sr_1_1?s=books&ie=UTF8&qid=1334961833&sr=1-1I have the C++ version of this, and have talked with peers that have the C version and say they are on par with each other. Very good as an instructional book, but also put together such that it makes an equally valuable reference to have on the shelf.

author: kiyotewolf
author_rank: Contributor
timestamp: May 27, 2012, 03:06:55 am
content: C is hard to wrap your brain around, if you're used to other types of programming.In assembly, unless you add in pre-built libraries, something like an overloaded operator, [i.e. something that can accept 8 bit unsigned integers, AS WELL as signed 8 bit integers, and even accepts 16 bit values - sketchy example..], has to be implemented, as different separate assembly routines, and you branch off, depending on what your inputs are, and what your outputs are.They used to call C, a macro language for assembly.You'd write C language code, and it would spit out a whole bunch of stuff, that was C in the IDE, but assembly, when it's all said and done./* Hello World program */#include<stdio.h>main(){printf("Hello World");}- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - cut here - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -/*Hello World program*/tags - their characters reverse, when going from an open comment tag, to a close comment tag#include<stdio.h>You tell the compiler, the # , that you want to INCLUDE, the console [text window interface program, no graphics or gui] support functions, so you can send messages out to the opened text windowmain(){printf("Hello World");}- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - cut here - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -and another flavor, C# (C sharp.. *.cs type files), will be good to see the alternative- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - cut here - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// A Hello World! program in C#.using System;namespace HelloWorld{class Hello{static void Main(){Console.WriteLine("Hello World!");// Keep the console window open in debug mode.Console.WriteLine("Press any key to exit.");Console.ReadKey();}}}- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - cut here - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -//A Hello World! program in C#.Using C#, you just put two forward slashes, and till the end of the line, is a commentusing System;same idea as the include statement, just written differentlynamespace HelloWorldTells the compiler to treat the following code, as a particular, something..I'd need help explaining this one better.{class Helloagain, need a helping hand explaining classes{staticvoidMain()static means, the variables inside don't disappear, they exist, so they can be used againvoid, means, you can send the routine values, if you wanted, but it won't spit any back at you.If you hadstatic int Main()the program would be obligated, to RETURN a value. The difference between a SUB and a FUNCTION, in QBasic, or a Method, and a <blank> in C variants.{Console.WriteLine("Hello World!");Console, dot, WriteLine, there is something called console, with an action called writeline, and the dot separates the thing, from the actions it is capable of doing.// Keep the console window open in debug mode.Console.WriteLine("Press any key to exit.");Console.ReadKey();}}}- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - cut here - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -C language is CAPS LOCK sensitive!!!If you write something, ..PURPLEand thenpurpleTHOSE ARE TWO DIFFERENT VARIABLES, or names of whatever.Also,computerMonitorTestThis is called, camel notation, the first word is lower cased, and the ones after, all have capital letters.Learned this, from someone teaching me C# for XNA Xbox Live development.~Paul[I don't want stupid whiney comments that I did this poorly, or weakly, I TRIED DANG IT. Deal with it.][also, I removed the CODE tags, cause it messed up my color tags]P.S.I have a PDF of C language, from old 70's computer magazines, goes into some detail about, the bare bones of C.I need to look through my nOOk, and see what issue of the scanned magazine is, so I can properly link to the PDF that's online already.

author: Bored@Work
author_rank: Super Contributor
timestamp: May 27, 2012, 06:21:15 am
content: Quote from: kiyotewolf on May 27, 2012, 03:06:55 amWrong. You are mixing C with C++. Which are not the same. I always find it funny when people can't even keep their languages separate, but then repeat the 40 year old rubbish statementQuoteThat statement was invented by some C haters who couldn't tell their opening brackets from their closing brackets and were still sucking mummies tits.QuoteEvery compiled language in those times, long before virtual machines became popular, was spitting out assembler code and would, applying that stupid criteria, have to be called a "macro language" for assembler, even FORTRAN.To the OP, forget most of the rubbish information on the web about learning C. Forget about the one page "tutorials" you find on the web - the blind leading the blind. Forget about people who can't keep C and C++ separate. Forget the "For Dummies" books. Forget the "Teach yourself C in 12 Minutes" rubbish books. Forget about any of the stupid textbooks that strife more for not challenging the student, not hurting their delicate soles, making a big fuss about their modern teaching concept, than presenting the facts of the language correctly. You have to make a decision. If you really want to learn the language, then this requires some thinking, putting in some time, and, *shock* *horror* really reading (as in page by page, with brain engaged, and concentrating on the text). If you really want to learn the language, get a copy of "The C Programming Language" by K&R. Work through it.

author: westfw
author_rank: Super Contributor
timestamp: May 27, 2012, 06:46:26 am
content: QuoteIf you know some assembler, you won't go too wrong thinking of C as an intermediate between an assembler (specifically, a PDP11 assembler) and an algebraic language.For example, a C statement likeCode:c = *p++;Is mysterious to many people who have used "typical" high level languages, but it corresponds quite closely to the "indexed addressing with post increment" address mode present in many computer architectures. On a PIC18, it would be something like:Code:movff postinc1, c

author: kiyotewolf
author_rank: Contributor
timestamp: May 27, 2012, 06:53:18 am
content: @Bored@WorkQuote"If you really want to learn the language, then this requires some thinking, putting in some time, and, *shock* *horror* really reading (as in page by page, with brain engaged, and concentrating on the text)."Way to go insulting the OP.And another thing, I sat down, with a simple tutorial, and modified XNA code, following the steps illustrated, and POOF.. I was programming in C. [C, C+, C++, C#, ALL VARIANTS OF ANSI C..]I don't see you writing anything intelligent, or any pearls of wisdom, except a single book title. I do see a bunch of snippy, immature remarks, and unneeded crude "humor," if that's what you call it, "Hero Member."

author: nctnico
author_rank: Super Contributor
timestamp: May 27, 2012, 08:06:39 am
content: Well, Bored@Work has a good point. Working through a good book and try the examples is the only way to learn a programming language properly.

author: kiyotewolf
author_rank: Contributor
timestamp: May 27, 2012, 08:33:50 am
content: "Working through a good book and try the examples is the only way to learn a programming language properly."For some people..You guys forget, you're here, cause of Dave's videos, and he's not a book, he's, a person, speaking, on video.You can learn how to program, from more than one single book.. lectures, videos,..Davecad..

author: baljemmett
author_rank: Unknown
timestamp: May 27, 2012, 12:08:07 pm
content: Quote from: kiyotewolf on May 27, 2012, 08:33:50 amLearning to program and learning a language are two very different things! As, indeed, are learning a language and learning a much more complex but more-or-less related language; trying to learn C by learning C++ or (worse) C# is doing things the hard way, as there's so much in the latter languages that simply doesn't even make sense in the C world.

author: typeglob
author_rank: Contributor
timestamp: May 27, 2012, 02:41:18 pm
content: Steer clear of object oriented languages like C++, C#, Java and even to a degree Javascript, Python, Ruby and Perl, PHP. You don't need the added complexity of OO (object oriented) programming when you're learning C.If you learn C and learn it properly (understand the concepts, instead of just knowing when to use what statement) you will also be able to use other (similar) languages without too much trouble. Sure, the exact syntax might be different, but the concepts are not (OO adds quite a bit of extra complexity and new concepts though).A lot of languages even look a lot like C (such as PHP, Java/C# and Javascript) while some others have a different syntax (like Basic and Pascal).You can include assembler sections quite easily in C (should you want to) and you can also ask the C compiler to save the assembler output (based on your C program) just before it compiles it, so you can have a look at the assembler code the compiler generates. For GCC you use the -S parameter for that.IMO, taking a 'shortcut' will turn out to cost you more time in the long run. With a shortcut I mean the type of books Bored@Work mentions at the end of his post. The K&R book mentioned by Yanir is the standard and it may be a bit dry at times, but there's a reason it is still used today. You really want the 2nd edition (which covers ANSI C) not the original version. And please be aware that modern compilers like GCC allow some C++ style statements in plain C.

author: Mechatrommer
author_rank: Super Contributor
timestamp: May 27, 2012, 08:06:36 pm
content: Quotecamel what? i used this technique alot and still is (way back 15yrs ago) lower case for local, upper case for global. who's your instructor's name? maybe i know him.and have you seen Micro$oft notation back then? (dont know now) "glob_", "loc" "underscore" etc. you'll have a fun time programming by typing letters.

author: Simon
author_rank: Unknown
timestamp: May 27, 2012, 09:26:58 pm
content: Quote from: kiyotewolf on May 27, 2012, 06:53:18 amWhile B@W can be quite blunt to the point of being deemed offensive, that point was not offensive to the original poster and a very good one. I personally find that these quick fix tutorials fix nothing and just end up putting people off because they promise you will learn something so fast but of course it cannot happen. This sort of scenario reminds me of my recent attempts to learn the Arduino where the instructions are presented in the form of a maze of tiny pages with hardly any information on and links to other stuff all over the place. That is not the way to teach a programming language to anyone.I have actually become quite edgy about buying books on programming, because it seems very few actually know how to teach from the ground up. I bought two books on how to program pics in assembler, I resold both for a fraction of what I paid for them, in one of them the author spent more time making stupid jokes that he thought were funny in the first half of the book and in the second half he just reproduced most of the material on the microchip websites and fielded with programs that were not even explained. in the other book I'm not actually sure what the author ever said although it was about 800 pages long.I have also decided to learn C, I was about to start a thread asking for recommendations on a decent IDE. Yes you're going to say GCC, well again just to keep things traditional it is not as simple as downloading it for windows. I have to actually compile it myself so that I can try out the examples in a book before I even know what compiling is really. I did find a program that creates a Linux type environment for GCC under Windows but that is not really what I was looking for. Any recommendations then on a proper IDE for a beginner? Or are there other iterations of the GCC program that is available to use out of the box?

author: Simon
author_rank: Unknown
timestamp: May 27, 2012, 09:34:02 pm
content: how does PHP relate to C? I know that developing websites is now akin to programming, will learning see paved the way to learning PHP?

author: Simon
author_rank: Unknown
timestamp: May 27, 2012, 09:37:25 pm
content: Quote from: kiyotewolf on May 27, 2012, 08:33:50 amif I am going to learn a language I want a book. Something I can carry around with me and pick up and refer to at any time. I think if you converted a proper book on C or any other language into videos it will work out a lot more viewing time and totally unmanageable for use as a reference. Having a video is great it can be more inspiring, but at the end of the day I want a book in my backpack I can pull out at any time I have time to do some reading.

author: Zero999
author_rank: Super Contributor
timestamp: May 27, 2012, 10:03:59 pm
content: Here's a good tutorial.http://computer.howstuffworks.com/c.htmIt's a bit dated in, recommending DJGPP which requires a DOS compatible operating system. Windows 64-bit users will either need to use an emulator (DOSBox, VirtualBox etc.) or use a free native Windows compiler such as MinGW.

author: TerminalJack505
author_rank: Super Contributor
timestamp: May 27, 2012, 10:30:57 pm
content: Are you looking for an IDE to learn C in Windows? If so then I recommendQT Creator. It uses the GCC toolchain but you'll never need to worry about that. And, yes, you can create plain-old C projects with it. The IDE is cross-platform and works with Linux and OSX as well.You don't have to compile anything to get the IDE working. Just install and go.Of course there is Visual Studio Express as well.

author: IanB
author_rank: Super Contributor
timestamp: May 27, 2012, 11:12:36 pm
content: If you want to do C in Windows, then Visual C++ 2010 Express is an excellent choice, free and very solid. (Ignore the C++ bit, it can do C as well.)I can do a few screen shots for you showing how to write and run the hello world program. It will get get you over the "where do I begin" dilemma that happens with all modern tools. But once you know, it's easy.

author: IanB
author_rank: Super Contributor
timestamp: May 28, 2012, 12:01:01 am
content: Here's a basic walk through.The steps should correspond to the order of attachments:1. Launch Visual C++ 2010 Express. Click New Project...2. Choose "General" and "Empty Project". Give it a name ("hello" in this case).3. Under Source Files, Add a New Item...4. Give your new file a name ("hello.c" in this case). The ".c" extension is important as it makes this a C file not a C++ file.5. Enter your code.6. Before running the program, make a change to the project settings7. Under Linker > System change the SubSystem type to Console. This will cause the program output to remain visible when the program finishes.8. Now you can build your program to see if it compiles OK9. ...and if it does, you can run it...10. ...and see the results

author: pkrobot
author_rank: Contributor
timestamp: May 28, 2012, 02:39:52 am
content: K&R is a wonderful book. I have bought books on programming, and I've gotten rid of them when they became obsolete, but I still have my copy from the school days, and still consult it from time to time.Reading it from cover to cover is not easy. Even if you read it, you won't retain everything. The best thing is to do a project, and get going. Hopefully, you'll stick to C (or C++), and eventually with practice and experience, become a very good programmer.I like Visual Studio, and occasionally use it for unit testing, but if you want to really learn C, then a better option is to install cygwin on your PC, and use Eclipse IDE. Better still, get started on Arduino. I've always found that just looking at lines being printed on the screen, blinking LED's and making motors spin is always more interesting.-pk

author: calin
author_rank: Regular Contributor
timestamp: May 28, 2012, 06:46:38 am
content: There are few books that are "the bible" of someone who knows C/C++ not only to learn it- C : Progamming in C / K&R- C++ - The C++ Programming Language / Stroustrup- C on UNIX systems (if you want to use embedded Linux this is II) - Advanced Programming in the UNIX environment / Stevens and UNIX Network ProgrammingAnd stay away from an IDE .. it makes you "dumb". Joke aside do make the effort to write your own Makefile. It will pay off in the long run trust me. For your own sanity .. learn C on a UNIX system first; not the UNIX API's ... the language itself. If you want to truly learn to respect C put this options in the compiler "-ansi -pedantic" you will hate them but they are "good".

author: Simon
author_rank: Unknown
timestamp: May 29, 2012, 09:47:35 am
content: Quote from: TerminalJack505 on May 27, 2012, 10:30:57 pmWell I'm trying to install QT but well with a 1.7 GB install file that is interesting. A straight download never completes and they have rigged it so that a download manager does not work. Doing the webinsall is taking hours and it looks like i will be putting a nice load on THEIR servers downloading it 3 times for each of my machines (assuming I use it). hopefully the program itself is better than their method of distribution.

author: IanB
author_rank: Super Contributor
timestamp: May 29, 2012, 05:36:02 pm
content: Quote from: Simon on May 29, 2012, 09:47:35 amI read the recommendations above about Cygwin and Eclipse, or QT Creator, and I have to wonder, "why, man, why?"Learning programming does not have to be torture to be useful. You want to be learning about C, not about various uncommon and peculiar programming environments.My recommendation to use Visual Studio was not given in jest. Visual Studio is heaps better and more polished than anything else you will find, and what's more it just works. No muss, no fuss. Install it, use it, be happy.

author: Simon
author_rank: Unknown
timestamp: May 29, 2012, 05:44:44 pm
content: I eventually managed to install QT, yes very daunting and 7 GB installation. I did promptly uninstalled it. I would probably try one of the others suggested and visual studio not that the download instructions are very clear for it.

author: Mechatrommer
author_rank: Super Contributor
timestamp: May 29, 2012, 05:47:48 pm
content: Quote from: IanB on May 29, 2012, 05:36:02 pmi still have a copy of TurboC, ver3, its "turbo" and no need to install (direct copy) if the OP want. but if you use later than WinXP, than you are out of your luck, its DOS.

author: Simon
author_rank: Unknown
timestamp: May 29, 2012, 05:48:58 pm
content: thank you for the offer, however I am looking to move forward and be future proof.

author: Mechatrommer
author_rank: Super Contributor
timestamp: May 29, 2012, 05:58:14 pm
content: Quote from: Simon on May 29, 2012, 05:48:58 pmthats the problem with "young" people. C in the past is C in the future. its... timeless. unless you want to move on to C#. but anyway... cant blame you people.

author: IanB
author_rank: Super Contributor
timestamp: May 29, 2012, 05:59:42 pm
content: Quote from: Simon on May 29, 2012, 05:44:44 pmCan you elaborate?It seems to me that you just go to this web pagehttp://www.microsoft.com/visualstudio/en-us/products/2010-editions/visual-cpp-expressand click the "Install Now" button?

author: Simon
author_rank: Unknown
timestamp: May 29, 2012, 06:01:52 pm
content: yes I found a page with a download button for the ISO. Previously I had gone round in circles looking at various versions, there was not much of a hint of downloading it on the other pages.

author: IanB
author_rank: Super Contributor
timestamp: May 29, 2012, 06:06:07 pm
content: I go the ISO route myself, but that is a bit more complicated. The online web installer will check for prerequisites and download only just what you need. It should be faster than the ISO install.

author: Simon
author_rank: Unknown
timestamp: May 29, 2012, 06:15:25 pm
content: I'm installing the web version now. they don't make the dam thing easy to find of course because it's free I tried to get you to buy it instead.I'm installing the C++ version there seems to be no C version

author: IanB
author_rank: Super Contributor
timestamp: May 29, 2012, 06:18:59 pm
content: Quote from: Simon on May 29, 2012, 06:15:25 pmIt's important to search for Visual Studio "Express". Express is the free version.Visual C++ 2010 Express is the one you want. It does C as well as C++. To use C, make sure to give your source files a ".c" extension rather than a ".cpp" extension.

author: IanB
author_rank: Super Contributor
timestamp: May 29, 2012, 06:20:14 pm
content: For future reference, here is the jumping off page for Express products:http://www.microsoft.com/visualstudio/en-us/products/2010-editions/express

author: TerminalJack505
author_rank: Super Contributor
timestamp: May 30, 2012, 12:39:25 am
content: Sorry to hear you had issues with QT Creator, Simon.Visual C++ Express is a fine IDE to learn C. It sounds like one of the big hurdles for you right now is the IDE. I know that an IDE can be overwhelming.Thankfully, once you learn one IDE you will pretty much know them all.

author: Mechatrommer
author_rank: Super Contributor
timestamp: May 30, 2012, 03:36:21 am
content: Quote from: TerminalJack505 on May 30, 2012, 12:39:25 amdead wrongide is a "language". different ide different vendor... different "language"... ie user interface, where that button, where this button. every ide need to be learnt, but C is still the same (not quite exactly... preprocessors).

author: TerminalJack505
author_rank: Super Contributor
timestamp: May 30, 2012, 04:15:05 am
content: Quote from: Mechatrommer on May 30, 2012, 03:36:21 amNah. It's more of a philosophy. All IDEs have the same philosophy or raison d'être.Computer languages are separate from IDEs. Obviously I wasn't saying that "once you learn one language, you know them all."

author: rsjsouza
author_rank: Super Contributor
timestamp: May 30, 2012, 12:29:03 pm
content: Hi,Although suggested by several people, I personally always found the K&R book very difficult to start from a beginner's perspective.When I was trying to learn C (15+ years ago) the way that Herbert Schildt wrote made a lot more sense to me. I used Herbert Schildt'sC: The complete referenceand the old Borland C's printed manuals. The printed manuals are a thing of the past, but the book can still be found to purchase after all these years.He has another book that may also be interesting calledTeach yourself C, although I never used it - again, his style of writing was what helped me.Regarding the IDE, my take is that most (if not all) of them have common basic concepts:- the arrangement of screens: menu bar at the top, projects on the left, source code in the middle, console output at the bottom;- most (if not all) of them work as an interface between the graphical world and a hard, command-line compiler / assembler / linker.- the concept of projects: a directory or file that builds an executable (or even a library) and can hold multiple source code files written in multiple languages (assembly, C and C++ are most common for MCUs);- also, each project allows to graphically set assembler, compiler and linker options (even with a help or descriptions of each option) and allows to perform a build of the project with a single click;- most of them nowadays have a way of debugging the project with a single click as well - however, in my experience that is what changes the most across IDEs.I've been using IDEs since the glorious Borland's Turbo C and these concepts haven't changed much since them. My personal opinion is that the IDEs of today come with such a set of example code and projects that really helps ramping up on its functionality - note that it is hard to learn C or a device this way, but at least gives a head start to compare why your code does not work and why theirs do...

author: baljemmett
author_rank: Unknown
timestamp: May 30, 2012, 02:55:02 pm
content: Quote from: rsjsouza on May 30, 2012, 12:29:03 pmNot wishing to detract from the value you found in his writing, but the name seemed familiar for some reason; a quick Google brought upa critique of the current editionby a (then) voting member of the ISO C committee, as well asa question regarding his textson StackOverflow.The latter links to thealt.comp.lang.learn.c-c++ FAQwhich be worth a read in itself for pointers to getting-started materials, etc.

author: rsjsouza
author_rank: Super Contributor
timestamp: May 30, 2012, 06:28:57 pm
content: Quote from: baljemmett on May 30, 2012, 02:55:02 pmThanks for the heads-up on the author and the technical accuracy of his books; back in the day there was a large number of garbage books on anything computer-related: several were copy-and-paste of data manuals or articles from Byte magazine... The options for decent books were rare. In any case I ended up getting what I needed (learning C), but I would agree that it may not be the best reference to be recommended anymore.O'Reilly books usually are made by very decent writers... I learned Perl and have friends that learned several other programming languages from their reference books - unfortunately I never used any of their books about C.

author: IanB
author_rank: Super Contributor
timestamp: May 30, 2012, 06:45:48 pm
content: I have Herb Schildt's C++ book myself. As I was reading it I came to the conclusion it was the worst computer book I had ever seen. It really is an utter train wreck. Please avoid it.

author: TerminalJack505
author_rank: Super Contributor
timestamp: May 30, 2012, 06:57:29 pm
content: Geez. I learned C such a long time ago that the books I learned from are all out of print. All except one that is and that is the classic K&R book. The fact that it is still in print probably says something.I already knew assembly language (various processors) and BASIC when I read the K&R book so it wasn't too bad. I can imagine that a complete noob might have problems, though.

author: Simon
author_rank: Unknown
timestamp: May 30, 2012, 07:03:24 pm
content: yes you're right, I have the K&R book and another book called "programming in C" edition three and I think this later book is easier than the former. They do say in the K&R book that they expect you to have some understanding of programming. I don't make it too complicated but programming in C does seem to start from the ground up talking about the programming language and about how programs are compiled.

author: rsjsouza
author_rank: Super Contributor
timestamp: May 30, 2012, 07:31:11 pm
content: Quote from: Simon on May 30, 2012, 07:03:24 pmI read the K&R book after a few years into C programming; I really appreciated as it clears out some previous misconceptions (maybe caused by Schildt's technical issues), therefore it is a great follow-up book.Quote from: TerminalJack505 on May 30, 2012, 06:57:29 pmWell, several of Schildt's books are still being printed...

author: xquercus
author_rank: Contributor
timestamp: May 30, 2012, 09:57:06 pm
content: While these are books which illustrate how to apply C to use with PICs, and don't actually teach C, I suggest:For C30 on PIC24s (already recommended):Programming 16-Bit Microcontrollers in C by Di JasioandFor C18 on PIC18s:Applying PIC18 Microcontrollers by Brey

author: SuperMiguel
author_rank: Regular Contributor
timestamp: June 08, 2012, 10:43:41 am
content: There's is also a 32 bit book on that series

author: Unknown
author_rank: Unknown
timestamp: June 11, 2012, 11:41:19 am
content: I'm not an EE and my maths is very poor etc, but I learned a lot from the "C Programming in Easy Steps" book and the dummies guide to C++.I would suggest beginners to build simple console exe's using the command line and text editor to understand the process; Start with a simple hello world then start using variables and functions, then passing and returning variables, then once you understand "pointers" you're good to go.Once you get the hang of it, you will dump the text editor and the command line, then you'll want to use a real IDE.But the most important bit of advice is to stick at it!

author: Mechatrommer
author_rank: Super Contributor
timestamp: June 11, 2012, 12:19:12 pm
content: C++ Nuts & Bolts - Larry Levitsky - McGraw-Hill (1995). not sure if its still around. my little mcu just cannot take pure virtual polymorphic class