C/C++ Programming Guide
by Roy Souther
www.SiliconTao.com

Forward

This guide is intended to help two groups of people, the first group is those that want to learn to program in C or C++. The second is for the experienced programmer that needs a quick reference guide to programming techniques and examples. This could not be done well in a printed book but thanks to hyperlinks I believe this will be possible. The fist part of the guide focuses on C programming only, the second part expands to C++. In both sections I will try to remain OS and compiler independent. Many books that teach C have been able to do this well, how ever I my library of hundreds of C++ books there are no books that teach C++ properly. Authors find it difficult to teach the actual workings of C++ so instead they teach the API for a given OS. This forces the reader to learn C++ from years of trial and error. This guide will change that.

If you have programed with other languages like ASM, Pascal, BASIC, Perl, Java, FORTRAN, COBOL, Python, Modula-2 or any thing like that you can pretty much fly through the first part and be coding C in no time at all. If you have never programmed before then you many want to do all of the examples and when you have finished the guide, start over and do it again. Many concepts in C rely on you having a good knowledge of C to use properly. Also, I may not have all of the examples in the best order.

If you intend on programming in C++, I recommend you have a strong understanding of C before you begin the second part. If you are great with C then you should review the first part before you go on to the second part.

If you would like to follow along with the programming examples as you go through the guide, skip ahead to the section on Links to free compilers and IDE's from there you can get the tools you need to practice as we work through the many examples and downloadable source code.

At some time in the future if people are wanting, I would like to add small Q&A test sections in to the guide to help the user evaluate there ability to understand what is being talked about, and to help me make improvements to the guide.

I also want this to be entirely a GPL (General Public License) guide. So all this information is licensed under the GNU GPL. Use it, copy it, improve it and share it.

Also, I make no clam as to the accuracy of any thing I have said here. If you think you have found an error please report it to the Support team of www.SiliconTao.com



Table of contents


What is C?
- What is a programming language
- The history of C
- Comparing C to other languages
- File hierarchy

The Syntax
- What is a compiler
- Preprocessor directives
- Comments in code
- Identifiers
-
Blocks & Lines
- Data types
- Type casting
- Operators
- Assignments
- Conditionals
- Loops
- Functions
- Pointers, arrays
- Advanced data types

Reserved words of C
- argc, argv, asm
- break
- case, char, const, continue
- default, do, double
- else, enum, extern
- float, for
- goto
- if, inline, int
- long
- return
- short, signed, sizeof, static, struct, switch
- typedef
- union, unsigned
- void, volatile
- while

Techniques of coding
- Prototyping
- Identifier naming
- Efficent commenting
- Recursion



What is C++?
- Things new in C++
- What are objects, classes
- Comparing C++ to other languages

Reserved words added for C++
- bool
- class
- delete
- false, friend
- new
- operator
- private, protected, public
- template, this, throw, true
- virtual

Objects and classes
- Defining a class
- Constructors, destructors
- Inheratance
- Overloading
- Operator overloading

ANSI C Standard libraries
- Input and output
- Format operators
- String mangaling
- Allocating memory

Usefull stuff
- Logical processing
- Bit mangaling
- Architecture considerations
- The GNU C function index
- Links to free compilers and IDE's
- Helpful resources

Example projects
- Sorting
- Linked lists