Everyone has to start somewhere and I started with C. Some say it's too hard for beginners, recommending Java, .NET, Perl . . .
I disagree. C is a strong, powerful language, almost unlimited in the scope of the programs and techniques that are possible. This power has a price and this is why some won't recommend C or C++ to beginners. It is very easy to make horrendous and catastrophic errors in C. I have written several programs that contained bugs that trashed my own system. Don't experiment with C unless you are prepared to repair the system when it goes horribly wrong. Later in this series, I'll take a quick look at preventing these kinds of errors, but C has the power to surprise you and throw you a problem that you simply had not considered. This is the attraction and the skill of programming in C - it is always a challenge and will test your problem-solving skills.
C programs can be simple and this is how I learnt the language. Always keep your code simple, keep your ideas clear and your comments full and descriptive. Simple C programs mean console or terminal programs - this is where you can learn the craft of C without the complications of extraneous GUI code. In the "bad old days" of BL (before Linux), this was called DOS programming. DOS has been suppressed in recent versions of Windows which makes it much more difficult to write these simple programs. GNU/Linux has not made that mistake and retains not only a command line but a complete console interface - many components of GNU/Linux can only be accessed from command line tools.
So this series will concentrate on these principles:
Everything I learnt about C and C++, I taught myself using books, experimentation and the internet. Some of my techniques will not get the approval of more experienced or better trained hackers or university lecturers. I can't cover areas of code that I haven't had to use, it's a simple, no frills introduction.
By concentrating on standard libraries and tools, I hope to provide a baseline that can give you a foothold on all platforms. The examples will be GNU/Linux based but the principles and techniques are applicable wherever a C/C++ compiler is available.
This is part of www.codehelp.co.uk Copyright © 1998-2004 Neil Williams
See the file about.html for copying conditions.