Jump to content

Recommended Posts

Posted

Hi,

I'm thinking about starting to learn C.

Are there any books (german preferred, english is also ok) you can recommend me?

I know that there's a lot of stuff on the web, but it's free and I don't know if I learn it right.

I'd prefer paying some bucks as I can be sure to learn it right.

matthias

Posted

yup, I recommend this book (german) :

you can test the first chapters and if you're okay with it, order the printed version.

C von A bis Z (German)

von Jürgen Wolf' date=' Galileo Computing

ISBN 3-89842-643-2

OpenBook (!) oder gebundene Ausgabe: 39,90 €

Ein sehr gutes, plattformübergreifendes (!) und übersichtlich aufgebautes OpenBook. Kann man online ansehen, als zip herunterladen (html) oder gebunden bestellen, was will man mehr? :)

http://www.galileocomputing.de/openbook/c_von_a_bis_z/

[/quote']

Best,

Michael

Posted

Theres a book review page in the wiki?  :o

i didn't know that...

Whats the main difference between C on the PC and on a PIC?

(as the proposed book seems to be about C on a PC)

Posted

On a PC you have all kinds of standard libraries, for example <stdio.h> for in- and outputs, eg. reading the console-input with scanf() and using printf() to print chars to the console-output.

Of course these libraries are not available on the PIC, so you have only to learn the C-basics like: Syntax, Grammar, Data-Tyes, Functions, etc...

These topics are all handled quite well in this book. I found it's one of the least confusing books regarding this issue compared to others  ;)

Regards,

Michael

Posted

I don't know If you understood my question (or If I just didn't understand your answer  ;))

This book is mainly about C at the PC, is it?

A PC usualy doesn't have any I/Os and ADCs in the way a PIC has.

Are those PIC-specific actions also described in that book?

Posted

Well, if you are writing a MIOS app, then you use the MIOS functions to handle such things as ADC. If not, you would use the SDCC libraries or whatever libraries are available. The libraries or the OS will take care of the low level functions, so you just handle the variables.

Posted

yeh, see it like this:

The basic C ist just the main grammar, like

- variables

- operators

- loops & conditions

- functions

That's it. Basically. Every language has these basic syntax and grammar items; for objective oriented languages, there are some more things to learn, but with similar simple languages like C, PHP, JavaScript, Java, Perl... that's it.

Once you got that, you can either:

- write your own low level functions (that would be to re-invent the wheel)

- or use existing low level functions (either in seperate files or bundled into libraries)

In theory it's the same if you get your variable 'i' either from the console (with the stdin library):

[tt]sscanf(stdio, "%i", i); // read input number from console[/tt]

or from a MIOS function:

[tt]i = MIOS_DIN_PinGet(pin);  // read state of pin number[/tt]

see, it's just a matter of reading the function reference, once you know where the "i", the "=" and the ";" belongs.

So, to sum it up: Learning a language consists of three steps:

1. you have to learn and get the syntax!

2. you have to program by yourself. Don't start with a huge IDE, just take a notepad (with the ability to compile the textfile, so you can learn on simple "one-filers").

3. you have to know how to look up: if you can manage the syntax, you just have to learn how and where to look up function and library references. Nobody can ever remember a thousand functions, it's normal to look these things up, so you don't have to "learn" all this complicated stuff. The main syntax is enough, for the rest you can search your preferred documentation.

Regards,

Michael

Posted

In theory it's the same if you get your variable 'i' either from the console (with the stdin library):

[tt]sscanf(stdio, "%i", i); // read input number from console[/tt]

or from a MIOS function:

[tt]i = MIOS_DIN_PinGet(pin);  // read state of pin number[/tt]

Except that the first one is passing an int instead of a pointer to an int and will stop your program with a segmentation fault if you're lucky and overwrite random parts of memory if you're not.

I definately agree with the idea of learning C on a PC first.  There you have memory protection to stop errors like this (especially if you use a library like dmalloc) and much better debuggers.  On the PIC you will just get your program behaving strangely and probably not even in the place that is causing the error.  I once allocated an array 1 element too short and didn't notice.  Then program started crashing when i added more code, regardless of what the code was or where i added it.

Posted

I just stumbled over a book I bought last week, that does seem like a good one for a very reasonable price:

"C Programmieren von Anfang an" von Helmut Erlenkötter, rororo, 9.90 €, ISBN: 3-499-60074-9

http://www.erlenkoetter.de/html/c.htm

What I like about it (besides the price) is that it's very clear structured and contains line-by-line explained examples for every entry; that makes it a valueable book not only to learn but also to look up things later.

Regards,

Michael

Posted

Achso, ne ich schau zuerst immer auf ebay, da dort die Dinge ja meist 10-20% unter Laden/Shoppreis verscherbelt werden.

Auf Amazon gabs das Buch für 9,99.- + Versand....auf Ebay 9,99.- ohne Versand ;)

was mich sehr überaschte bei dem Preis :)

  • 5 weeks later...
Posted
I don't know If you understood my question (or If I just didn't understand your answer  Wink)

This book is mainly about C at the PC, is it?

native C Code is on all plattforms the same...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...