PDA

View Full Version : Good C tutorial...


AsLan^
2005-10-10, 13:48
So... I decided to learn C. What I need now is some kind of online tutorial to learn C with :)

I've searched the forums, and googled the internet. The forums had a couple of links but they don't work anymore and the internet has countless C tutorials. I tried one of them and it irritated me on the third "lesson" so that's why I've decided to ask for recommendations.

I'm proficient with Java (well I think I am) and I'm not scared to dive into a good text file tutorial.

I'm not too keen on buying any books at this point because I really just want to learn basic C before diving into C++ and Objective-C.

So, can anyone recommend a good online C tutorial ?

Kickaha
2005-10-10, 13:57
Yeah, don't bother, if you're going Obj-C. :) Learn the syntax, obviously, but learn Obj-C's object methodology first, since you're likely to be spending more time in it than anything else.

If you're learning C++, then you need to know C pretty well inside and out to use it effectively. It mixes the object and procedural models in nasty intertwined ways for no good reason, IMO.

AsLan^
2005-10-10, 14:05
Yeah, don't bother, if you're going Obj-C. :) Learn the syntax, obviously, but learn Obj-C's object methodology first, since you're likely to be spending more time in it than anything else.

If you're learning C++, then you need to know C pretty well inside and out to use it effectively. It mixes the object and procedural models in nasty intertwined ways for no good reason, IMO.

I guess I really want to learn C++ eventually, the reason I mentioned Objective-C is because I'm interested in that too and I thought they were similar i.e. both object oriented. But I'm mostly a cross-platform person so Objective-C is of limited use.

I am also interested in learning how to program device drivers which I think is done in C.

So... can anybody point me in the direction of a good C tutorial ?

staph
2005-10-10, 14:13
Have you considered getting a subscription to the Safari bookshelf (safari.informit.com)? They've got several dozen books on various flavours of C.

AsLan^
2005-10-10, 14:17
Have you considered getting a subscription to the Safari bookshelf (safari.informit.com)? They've got several dozen books on various flavours of C.

I looked into that the other day actually, $20 a month is fairly reasonable but I hate the idea of spending $240 a year and not having any books to show for it. The physical book is sometimes more useful to me too, the number of times I've had a book on my lap and the Java API in the browser are too numerous to mention ;)

staph
2005-10-10, 14:21
I looked into that the other day actually, $20 a month is fairly reasonable but I hate the idea of spending $240 a year and not having any books to show for it. The physical book is sometimes more useful to me too, the number of times I've had a book on my lap and the Java API in the browser are too numerous to mention ;)

Actually, if you get the no-download version it's somewhat cheaper — $10/mo for five books, $15/mo for 10.

I basically figure that given my frighteningly short attention span and the propensity for computer books to both be pretty expensive, and become obsolete rapidly, it makes more sense to subscribe to them. $180/year is really only 3 or 4 decent books' worth… and I get a lot more value out of it than that over the period in question.

As for your browsing problem, well, you just need to get more monitors. ;)

AsLan^
2005-10-10, 14:25
As for your browsing problem, well, you just need to get more monitors. ;)

I'll run that by the wife :lol:

Kickaha
2005-10-10, 14:37
IMO, if you already have the basics of programming under your belt with Java, just go grab a copy of K&R (Kernighan and Ritchie), the updated ANSI version, and start reading it. It's the definitive C reference for most people, and it's short and dense, but then, there's not much to C.

AsLan^
2005-10-10, 14:52
IMO, if you already have the basics of programming under your belt with Java, just go grab a copy of K&R (Kernighan and Ritchie), the updated ANSI version, and start reading it. It's the definitive C reference for most people, and it's short and dense, but then, there's not much to C.

No doubt I'll pick that up, doesn't seem to be any online versions of it though because they are still making money from it !

Kickaha
2005-10-10, 15:28
Yeah, but it's cheap. I mean, it's only like 120 pgs.

spotcatbug
2005-10-10, 17:21
No doubt I'll pick that up, doesn't seem to be any online versions of it though because they are still making money from it !

Every more-than-a-line-on-my-resume C programmer has a copy of K&R. New C programmers are born everyday. Ergo, they're still selling 'em.

AsLan^
2005-11-16, 01:41
Okay, okay, I know I'm whinging about Obj-C vs java in another thread but I'm still having fun learning C.

The K&R was a great choice and thank you to you guys for suggesting it.

But now I would like to start making programs with GUI's and or graphics.

Anybody know a good cross platform toolkit that I can start learning from online resources, I had a look at Allegro and SDL but they seem a little advanced, and their online references and tutorials seemed a little lacking to me. Perhaps it's my lack of experience.

What do you guys think of GTK ?

Kickaha
2005-11-16, 01:53
C's a fun pedal-to-the-silicon language. :) You should try playing around with some asm blocks in it sometime and really take it out for a spin. :D

But for GUI work, you're going to hate me but... OO. The more pure, the better. Squeak/Smalltalk is a great way to learn OO and play with a GUI build kit at the same time. You'll learn the granddaddy of all design patterns, MVC, to boot. (It's also ubiquitous in Cocoa.)

I can't imagine going back to the world of callbacks and manually handled function pointers after working in nice rich OO environments. *twitch*

AsLan^
2005-11-16, 03:14
Squeak/Smalltalk is a great way to learn OO and play with a GUI build kit at the same time. You'll learn the granddaddy of all design patterns, MVC, to boot. (It's also ubiquitous in Cocoa.)

If I make a program with smalltalk or squeak, will the user need a VM to run the program ?

The website seems contradictory, one page says

To achieve practical performance, a translator produces an equivalent C program whose performance is comparable to commercial Smalltalks.

Which implies that the end result is a C program, but at the same time there are numerous references to a VM which I think would be unecessary for executing a C program.

Swing
2005-11-16, 05:08
A belated comment on Kernighan and Ritchie's book: as long their excellent "The C Programming Language" (ANSI C), 2d Ed. has been recommended, you may also want to consider its companion book, Tondo and Gimpel's "The C Answer Book", 2d ed., which contains well written code solutions to the exercises in the other book.

Kickaha
2005-11-16, 09:58
If I make a program with smalltalk or squeak, will the user need a VM to run the program ?

Both. :) You use the VM for development, etc, and optimally, deployment. You *can*, however, translate the code to C for portability and speed if you need to. You just lose any capability of dynamic updating later.

A lot of folks will, after proper profiling and testing, translate the bare minimum critical path code to keep as much of the dynamic environment as they can.