Exercises, examples and other material relating to training module C202. This topic is presented on public courses Learning to Program in C
, Learning to program in C++
, Programming in C
, C and C++ Programming
Programs store information in variables, and we'll look at
how these are declared, initialise and used for calculation in
C. We'll also look at reading inputs from the user and writing
information back out so that by the end of this module you'll have
written a simple but practical program in C.
|Articles and tips on this subject||updated|
|3590||Defining, declaring and initialising variables in C|
When you declare a variable in C, you're instructing the compiler to set memory aside for it, and you're also telling the compiler how to handle any references to that memory.
• C does NOT spend time working out what sort of data you're storing and how many bytes are needed - it's up to you to ...
|3236||C - a first program that does something useful for you|
Any language has a whole number of different types of element that come together to make a whole.
Let's take a spoken language such as English. You need nouns - they're 'thing' words like "platypus" and "road", "carrot" and "Walter". Then you need verbs to join them together - they're 'doing' words ...
|3121||New year, new C Course|
Well - not completely a new course. New delegates, and lots of new examples written for them during the first day to that they can see not only WHAT work but also HOW the design of what works is put together during the day. Click on the individual source code examples, and you'll find programs to ...
|2580||C course inspires new teaching examples|
If you're reading this article as one of a series in my blog, looking for amusing anecdotes, and news of Melksham, you may be getting a bit concerned at the long series of articles on C and C++. This week, I was at meetings at Well House Manor on Tuesday evening, the divisional police HQ on Wednesday ...
|888||Turning C from source to a running program|
With scripting languages (or near-scripting languages) such as shell, Tcl, Perl, Python and PHP, the developer just edits a file of program code, and tests it - the tools that he uses roll the translation of his source into something that can be run without him having to make further inputs. C is somewhat ...
Examples from our training material
|adder.c|| Variables and arithmetic in C|
|calcit.c|| First calculation|
|cvopt.c|| Prompt - read - calculate - decide - report|
|fred.c|| Calculation of VAT on an amount|
|makefile|| makefile for module C202|
|nranges.c|| Testing number ranges in C|
|second.c|| Read, Calculate, output results |
|tconv.c|| Temperature conversions|
|vars.c|| Delaring but not initialising - what happens?|
|vars2.c|| Declaring and initialising variables|
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
Variables, types and numeric types.
Float and ints. Short long and double.
Basic use of printf.
Input from the user.
Conversion and type casting.
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.