Author Topic: Want to learn "C"  (Read 14345 times)

0 Members and 1 Guest are viewing this topic.

Offline alan monro

  • Contributor
  • Posts: 17
  • Country: au
Want to learn "C"
« on: September 30, 2012, 12:12:14 am »
Would anybody please tell me if there is a better book than "C" for dummies as there are many projects I wish to make using the Arduino . I have already have a evaluation  board  and have programed a flashing led , but , that is only the smallest fraction of what that  powerful  computer can do. Thank you, ..............................Alan
« Last Edit: September 30, 2012, 12:14:50 am by alan monro »
 

Offline nctnico

  • Super Contributor
  • ***
  • Posts: 18908
  • Country: nl
    • NCT Developments
Re: Want to learn "C"
« Reply #1 on: September 30, 2012, 12:42:45 am »
Well there is "the C language by Kernigham & Ritchie": http://zanasi.chem.unisa.it/download/C.pdf. This is written by the inventors of the C language. Some regard this book as the ultimate C bible because there is no book closer to the source of the C language  8)

Besides that a good way to learn is to look at software other people wrote. Some examples are bad and some are good so when looking for a solution make sure to look at at least 5 different solutions and pick one that looks uncomplicated and you can understand.
« Last Edit: September 30, 2012, 12:44:51 am by nctnico »
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline oldrose

  • Contributor
  • Posts: 13
Re: Want to learn "C"
« Reply #2 on: September 30, 2012, 12:46:37 am »
Every C programmer should have "The C Programming Language" by Kernighan and Ritchie and I highly recommend "A Book on C" by Kelley and Pohl.

 

Offline IanB

  • Super Contributor
  • ***
  • Posts: 9630
  • Country: us
Re: Want to learn "C"
« Reply #3 on: September 30, 2012, 12:47:47 am »
Tread carefully though: Arduino sketches are not written in C, even though the language is similar.
I'm not an EE--what am I doing here?
 

Offline updatelee

  • Contributor
  • Posts: 43
Re: Want to learn "C"
« Reply #4 on: September 30, 2012, 01:45:42 am »
I learned in University on the Deitel and Deitel books, they are excellent.

UDL
 

Offline JuiceKing

  • Regular Contributor
  • *
  • Posts: 233
  • Country: us
Re: Want to learn "C"
« Reply #5 on: September 30, 2012, 03:42:28 am »
K&R is the reference, and important as it is to read and own, if it were perfect there wouldn't be so many other books trying to supplement it. The book Deep_C_Secrets helped me understand C better than any other. It's context is way out of date, but the concepts that it explains are timeless. I'm sure it's out of print, but maybe a search in Amazon or Abebooks will turn up a copy.
 

Offline poptones

  • Frequent Contributor
  • **
  • Posts: 711
  • Country: 00
 

Offline Pagweb

  • Contributor
  • Posts: 6
  • Country: us
Re: Want to learn "C"
« Reply #7 on: September 30, 2012, 06:51:53 pm »
I learned C at my university too. The book we used was 'Problem Solving and Program Design in C' by Hanly Koffman. Is a good book for beginners and it has examples and practice problems. You can get a used version in Amazon for like $10.
 

Offline grumpydoc

  • Super Contributor
  • ***
  • Posts: 2701
  • Country: gb
Re: Want to learn "C"
« Reply #8 on: September 30, 2012, 07:00:04 pm »
K&R is probably my favourite book on any programming language. It sets out to describe the C language and does so with the minimum of fuss and extraneous detail.

It helps that K&R C is a very compact language - ANSI C has bloated somewhat and C++, much as I like it, is actually a nightmare.

It is an excellent example of the Unix philosophy of "one task, done well" and I thoroughly recommend it if you are learning C.

However you also need a good reference on the platform - modern systems are much more than the programming language and you need to know as much about he environment as possible to make effective use of it.
 

Offline Bored@Work

  • Super Contributor
  • ***
  • Posts: 3932
  • Country: 00
Re: Want to learn "C"
« Reply #9 on: September 30, 2012, 07:03:23 pm »
http://kat.ph/expert-c-programming-deep-c-secrets-peter-van-der-linden-pdf-t6506890.html

Oh, come on. One doesn't become an expert out of nothing by reading an expert/secret book. Such books are snake oil.
I delete PMs unread. If you have something to say, say it in public.
For all else: Profile->[Modify Profile]Buddies/Ignore List->Edit Ignore List
 

Offline mtkaalund

  • Contributor
  • Posts: 32
  • Country: dk
Re: Want to learn "C"
« Reply #10 on: September 30, 2012, 07:57:29 pm »
Tread carefully though: Arduino sketches are not written in C, even though the language is similar.

And what do you based that on?
The arduino "language" is just a framework, that you program around, but it stil uses AVR-GCC and AVR-LIBC http://arduino.cc/en/Hacking/BuildProcess
"Keep buggering on" -- Winston Churchill
VIR => V = I*R, neat ;)
 

Offline Simon

  • Global Moderator
  • *****
  • Posts: 14441
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Want to learn "C"
« Reply #11 on: September 30, 2012, 08:04:16 pm »
I got a book called "programming in c" by Stephen kochan it is very good. To be honest just reading others programs won't help one little bit unless you know so c, I'd prefer a less compact language, in the long run it would be faster for me to use and understand.
 

Offline IanB

  • Super Contributor
  • ***
  • Posts: 9630
  • Country: us
Re: Want to learn "C"
« Reply #12 on: September 30, 2012, 08:33:31 pm »
And what do you based that on?
The arduino "language" is just a framework, that you program around, but it stil uses AVR-GCC and AVR-LIBC http://arduino.cc/en/Hacking/BuildProcess

I base it on the link you provided.

The C programming language consists of the standard language syntax and standard set of libraries (with a corresponding set of standard named header files).

The Arduino programming language uses different libraries and header files and macro definitions, and it also includes elements of C++ (which is not C).

So although programming an Arduino may be similar to writing C, it is not C. If you try to work through K&R and follow the examples and exercises as given you will run into trouble.

An experienced person may be fully aware of this, but it is not something that may be equally clear to beginners.
« Last Edit: September 30, 2012, 09:46:34 pm by IanB »
I'm not an EE--what am I doing here?
 

Offline TerminalJack505

  • Super Contributor
  • ***
  • Posts: 1306
  • Country: 00
Re: Want to learn "C"
« Reply #13 on: September 30, 2012, 09:12:51 pm »
I have to agree with IanB here.  Strictly speaking sketches are neither C or C++.  This can really trip-up a newcomer.  For good or bad  Arduino sketches are their own little beast. 

For example, try putting a struct declaration in your Arduino sketch.  It won't work.  It does in C/C++.  Someone trying to learn C or C++ will find this very frustrating.

Someone who already knows C/C++ will find this merely quirky.  (A 10-second Google search reveals that the workaround is to simply put the declaration in a .h file.)  A noob will likely waste countless hours with a problem like this, however, and will likely come away feeling duped into thinking that Arduino sketches are "just" C/C++ code.
 

Offline phil_jp1

  • Regular Contributor
  • *
  • Posts: 103
  • Country: ua
Re: Want to learn "C"
« Reply #14 on: September 30, 2012, 09:42:23 pm »
It's has been mentioned earlier and I will repeat it:
Apart from reading a book(doesn't matter how good that book would be), you should learn from others code! Learn design patterns in process.

Another really good way to learn is to take someone's code, compile it to see if it works, then change something and compile it again, pay attention to compiler generated errors and warnings, fix the problems and run the program, then repeat this cycle again.
http://JumperOne.com - Electronic projects, tutorials, hacks, etc.
 

Offline JuiceKing

  • Regular Contributor
  • *
  • Posts: 233
  • Country: us
Re: Want to learn "C"
« Reply #15 on: October 01, 2012, 01:04:49 am »
http://kat.ph/expert-c-programming-deep-c-secrets-peter-van-der-linden-pdf-t6506890.html

Oh, come on. One doesn't become an expert out of nothing by reading an expert/secret book. Such books are snake oil.

Since I recommended this book, I'll defend it. The author, Van Linden, managed the compiler team at SUN, and many of the "secrets" he reveals are things that anyone who has actually implemented a compiler would know. If you don't have this experience, the insights might be hard to come by otherwise. His introductory book on Java (also badly dated now) was similarly great.
 

Offline alan monro

  • Contributor
  • Posts: 17
  • Country: au
Re: Want to learn "C"
« Reply #16 on: October 01, 2012, 06:30:21 am »
Every C programmer should have "The C Programming Language" by Kernighan and Ritchie and I highly recommend "A Book on C" by Kelley and Pohl.

Thank you....................Alan
 

Offline alan monro

  • Contributor
  • Posts: 17
  • Country: au
Re: Want to learn "C"
« Reply #17 on: October 01, 2012, 06:32:53 am »
Well there is "the C language by Kernigham & Ritchie": http://zanasi.chem.unisa.it/download/C.pdf. This is written by the inventors of the C language. Some regard this book as the ultimate C bible because there is no book closer to the source of the C language  8)

Besides that a good way to learn is to look at software other people wrote. Some examples are bad and some are good so when looking for a solution make sure to look at at least 5 different solutions and pick one that looks uncomplicated and you can understand.

Thanks to everybody who gave suggestions..............................................Alan
 

Offline alan monro

  • Contributor
  • Posts: 17
  • Country: au
Re: Want to learn "C"
« Reply #18 on: October 01, 2012, 06:36:32 am »
Every C programmer should have "The C Programming Language" by Kernighan and Ritchie and I highly recommend "A Book on C" by Kelley and Pohl.
[/



Thank you I will download the book you so kindly gave me. ...............................................Alan
 

Offline T4P

  • Super Contributor
  • ***
  • Posts: 3706
  • Country: sg
    • T4P
Re: Want to learn "C"
« Reply #19 on: October 01, 2012, 07:12:56 am »
Oh, come on. One doesn't become an expert out of nothing by reading an expert/secret book. Such books are snake oil.
 

Offline Kremmen

  • Super Contributor
  • ***
  • Posts: 1283
  • Country: fi
Re: Want to learn "C"
« Reply #20 on: October 01, 2012, 06:22:30 pm »
My 2 cents worth: while not strictly an elementary instruction book, the "Elements of C Programming Style" by Ranade and Nash can be worth checking. Most of the guidance given in there is as valid today as the day it was written. Works for me at least.
Nothing sings like a kilovolt.
Dr W. Bishop
 

Offline Ferroto

  • Frequent Contributor
  • **
  • Posts: 289
  • Country: ca
Re: Want to learn "C"
« Reply #21 on: October 02, 2012, 12:10:32 pm »
Even better then a book.

 

Offline alan monro

  • Contributor
  • Posts: 17
  • Country: au
Re: Want to learn "C"
« Reply #22 on: October 02, 2012, 10:14:40 pm »
Thanks Ferroto.....................................Alan
 

Offline andyturk

  • Frequent Contributor
  • **
  • Posts: 892
  • Country: us
Re: Want to learn "C"
« Reply #23 on: October 04, 2012, 09:23:44 pm »
Even better then a book.

Ugh. That's the thing with IDEs--you spend an hour screwing around with project and Makefile creation before you can even get to running some C code. Yuck.

Back around the time when dirt was invented, I learned C on a PDP-11 running Unix. I had a copy of K&R on the desk beside me and worked through simple examples in minutes using just a command line:

$ ed hello.c
a
#include <stdio.h>
int main(int argc, char *argv) {
 printf("Hello World!\n");
}
.
w
q
$ cc hello.c
$ ./a.out
Hello World!
$

The same thing still works on my Mac today. Woo hoo!

You kids can keep your IDEs.  :P
 

Offline Kremmen

  • Super Contributor
  • ***
  • Posts: 1283
  • Country: fi
Re: Want to learn "C"
« Reply #24 on: October 05, 2012, 07:25:03 am »
An hour is a long time (for IDE setup)? Do you honestly know a single SW project that failed because the IDE took so long to set up?
There are pros and cons for IDE and non-IDE project setup. Some advanced things are a bit difficult to do in an IDE environment but your basic project dependencies, tool parameterization  and build is not one of them. That is one big reason why i find myself doing everything in an IDE these days (at least for AVR-GCC projects).
Some like to bash e.g. the AVR Studio in its different versions but i can live with it quite nicely. And as to project setup, it takes all of ca. 10 seconds and you are good to go. For me it is a big value that the IDE lets me concentrate on solving the software creation task, not mess with tool setup and operation at every iteration.
Nothing sings like a kilovolt.
Dr W. Bishop
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf