Exercises, examples and other material relating to training module C211. This topic is presented on public courses Learning to Program in C
, Learning to program in C++
, Programming in C
, C and C++ Programming
If you want to do something and think "surely that's
been done before", then it probably has been. C is supplied
with a library of standard funcions and header files that save
you the need to rewrite many of the basics that you'll need,
and we'll introduce you to these standard components in this
module. We'll also show you where to find other sources of
code that's already written, and suggest that you might like
to share your work similarly.
|Articles and tips on this subject||updated|
|3244||C and C++ - preprocess, compile, load, run - what each step is for|
C and C++ original source code goes through a number of steps on its way to becoming a runnable program.
1. The C Preprocessor is run on the original source. This takes the source lines that start with a # character and acts on them as directed. (It does a bit more too - more about that anon!)
|3234||Your program - you just provide the filling in the sandwich|
You may think (and say) that you're writing a program ... but you never write a complete program these days. What you do is to provide the filling to the sandwich - the bit that changes from one application / requirement to the next, and you then make use of standard surrounding material - the bread.
|3148||OpenGL / C / C++ - an example to get you started|
A Computer Graphics application in C / C++ - that's the coding that one of my delegates is going to be doing for her "real work" after this week's course, and I found myself looking back to old times - when I used (amongst other things) to subcontract to Silicon Graphics to present courses on their GL ...
|2575||Sharing variables between files of code in C - extern|
In C, If you want to share a variable between a number of functions, you can declare it at the top of your file, outside the functions. It's then an element that's held in memory all the time and available to all your functions. Since your functions are separate elements which are joined together at ...
Examples from our training material
|abc.h|| include file example for cpp.c|
|bathroom.c|| Sharing extern variables - a file of functions|
|clever.h|| Example of included file|
|cpp.c|| C Preprocessor examples|
|ex1.c|| use of #define and #include|
|first.c|| The Sandwich of your application within standard elements|
|hash|| Sample preprocessor directives|
|house.c|| Sharing variables between object files - main program|
|shared.c|| First example of shared code|
|ten.c|| Preprocessor directive demonstration|
|waterhorse.h|| extern, and use of preprocessor to control it|
Some modules are available for download
as a sample of our material or under an Open Training Notes License
for free download from http://www.training-notes.co.uk
Topics covered in this module
The C preprocessor.
stdarg stddef stdio and stdlib.h.
math and limits.h
errno ctype and time.h
If you are looking for a complete course and not just a information on a single subject, visit our Listing and schedule
Well House Consultants specialise in training courses in
. We run
throughout the UK (and beyond for longer courses), and
at our training centre in Melksham, Wiltshire, England.
It's surprisingly cost effective to come on our public courses -
even if you live in a different
country or continent to us
We have a technical library of over 700 books on the subjects on which we teach.
These books are available for reference at our training centre. Also
available is the Opentalk
Forum for discussion of technical questions.