Forum Moderators: phranque

Message Too Old, No Replies

Learning to C

Looking for docs

         

brotherhood of LAN

5:17 pm on Aug 14, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Hey folks,

HTML, PHP, CSS, mySQL- the things I can say that I 'dabble' with :) I looked at XML, got scared, and thought I'll reapproach it later in the year :)

I was introduced to C not too long ago, and I've heard its very similar in syntax to PHP and perl.

I'm wanting to get familiar with C- knowing that its the language of languages! I was hoping to get some suggestions in regards to sound and easy to understand tutorials that may be kicking about the web.

Would also love to hear of any projects you are proud of if you are a C programmer :)

mavherick

5:56 pm on Aug 14, 2002 (gmt 0)

10+ Year Member



It's interesting that you're mentionning C since I have to start working on some COM objects that are written in that language. I've started my research at the ODP [dmoz.org], but no luck so far.

I'll keep an eye on this post and mention anything I found useful.

mavherick

bird

6:39 pm on Aug 14, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



There's only one authoritative source on that one:

Brian W. Kernighan, Dennis M. Ritchie
"The C Programming Language"
ISBN 0-13-110370-9
ISBN 0-13-110362-8 (paperback)

And yes, this is enough to actually learn the language!
It's one of the few "specifications" that can easily double as a tutorial.

I'm sure there are also a few good online resouces out there, but I learned C before the www existed, so I couldn't tell which ones those are... ;)

littleman

6:50 pm on Aug 14, 2002 (gmt 0)



Last time I looked I wasn't happy with the online tutorial situation.

lioness

9:50 pm on Aug 14, 2002 (gmt 0)

10+ Year Member



Deitel & Deitel are also very good....

brotherhood of LAN

10:15 pm on Aug 14, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I took a scan of some of the online tutorials, and although no doubt they do the job- they look pretty dated and a hassle to save for future use.

Thanks for the book tip bird - though I'll be needing a non-IE browser to buy it online ;)

Duckula

11:40 pm on Aug 14, 2002 (gmt 0)

10+ Year Member



I can't really remember when I really learned C... :) One day the concept of pointer just was clear to me, just like that.

I'd say that the better tutorial you can get is the real world practice, begin by the old


#include <stdio.h>
#include <stdlib.h>

int main(int argc, char* argv[]) {
printf("Hello, world!, %s\n", argv[0]);
if(argc > 1) {
printf("%d \n", atoi(argv[1]));
}
return 0;
}

(Why doesn't the indenting works between my code tags?)
(on a *nix run 'man printf' and 'man atoi' for lots of details)

and try to understand every piece of it, and I mean *every* piece. What are argv and argc, why argv is a pointer to pointer, compile it on your platform and get zero warnings... that is a good beginning and maybe not as easy as it sounds.

I find the Linux man pages a good enough reference for daily usage; every libc call is documented there not so uglishly.

I don't think that learning C can be a short term process; you keep on learning as time goes.

Do you want some bookmarks? A few pages that have content I have actually used:

[vergil.chemistry.gatech.edu...]
[contrib.andrew.cmu.edu...]
[heather.cs.ucdavis.edu...]

And, above everything, keep on coding.

txbakers

1:38 pm on Aug 17, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



COM, DOM, EDI,EAI, etc. are all going bye-bye as the concept of "web services" takes root.

I've seen several good examples of how easy the SOAP/XML/WSDL combination can interface and it really is the future.

C is great for stand alone applications, but unless you already know it, for web work it's like learning Ancient Greek just for the fun of it. It's not needed anymore.

bird

1:56 pm on Aug 17, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



for web work it's like learning Ancient Greek just for the fun of it. It's not needed anymore.

Let me guess: You really never bothered with ancient greek and/or latin?

I had to sit through endless latin lessons in school. I sincerely hated it, it was my worst subject by a margin, and I know that I'll never directly use it for anything practical. But I also know that the bits and pieces I remember from those lessons have helped me tremendously in learning several other languages, and in deciphering texts written in yet more languages that I don't speak or read fluently.

C is in a much better position than latin. Whether you like it or not, most of the code running on some computer today is written in C. I use it rarely but regularly, be it for small utilities where performance counts, or for fixing/modifying other peoples code that I'm using in my projects. C is the mother (or at least one of the mothers) of the vast majority of programming languages in existence today. If you know C, then you'll do better in all of them.

txbakers

7:39 pm on Aug 17, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



<chuckle>No I never learned ancient Greek or Latin</chuckle>

I'll agree that any knowledge is valuable, but I wouldn't recommend new programmers to go back and learn C. If the focus is web related, there is so much to learn that is new and future oriented.

If a person already is familiar with C, C++ , COBOL, etc. they can leverage that knowledge in today's environment, but I wouldn't go back and learn them at this point.

bird

9:13 pm on Aug 17, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If a person already is familiar with C, C++ , COBOL, etc.

I wish you wouldn't have mentioned COBOL in that context, because that is one of those languages that you can't leverage in a modern programming environment. If you shold ever bump into some COBOL code by accident, please do yourself a favour and look away... ;)

Note that BOL didn't ask for C as his first language, even though most of the other things he mentioned aren't really programming languages (if you have zero programming experience, your best start will be with Python). However, as a second or third language, I can recommend C without hesitation. Besides being ubiquitous, C is also a very simple and straightforward language. Once you have wrapped your mind around how pointers work, it's definitively a lot simpler than Perl, probably still simpler than PHP, while I would place Python approximately on the same level (in itself, Python is still simpler, but it balances that by adding integrated object orientation).

The book I recommended describes the full specification including most of the standard library, in the form of a tutorial suitable for an ambitious beginner, on just 250 pages. A book about C++ will waste about the same space just for explaining the basic concepts, and in the typical Perl book you won't even have seen all the special symbols yet after coming that far.

Would also love to hear of any projects you are proud of if you are a C programmer

I read over that one until now. This program [webmasterworld.com] probably isn't something to be especially proud of, but it's a quick and practical solution to a common problem. Run it through a pretty printer, and enjoy. Once you understand every detail of how it works and why, you may already have a pretty good grasp of the language. It's also a reasonable example of defensive programming to avoid buffer overruns and similar pitfalls.

Those of my C projects that I am proud of would probably just scare you away. ;) I tend to use it as a last resort in those places where Python doesn't quite fit anymore, or when integrating Python with other software systems. Most of those examples aren't web related at all.

brotherhood of LAN

10:28 pm on Aug 17, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Many thanks for the excellent posts so far!

I managed to get python working before C :)

it looks pretty smooth. I'll still be wanting to look at C though.

I've been used to learning the low level languages coming in as a web newbie, though I've had a comp for a while. Bird, you say you do most of your C work for offline purposes...and I hope to do a bit of a mix :)

Just seems wise to get to grips with at least a little of each code so you know about all the pieces of the jigsaw and what they are capable of.

I think C and XML (looks horrible to me) will be long,long term......something to add to the seemingly endless sea of information and languages to be used online and offline

Duckula

12:41 am on Aug 18, 2002 (gmt 0)

10+ Year Member



>I managed to get python working before C

Excellent choice. As a matter of fact, a project that I am coding on my free time has a core on C++, carefully coded directly into memory (using pointers), that is extended with python functions.

That's why you would use C or C++, anyway: to handle the memory at low level; for anything else, there are the very high level languages.

Maybe you wouldn't care, but if you have access to an OpenGL accelerated linux machine and development libraries for xlib, GL and python you can try my little cad program [soffernet.com].

I had a nice page for it too, but the server ate it :)