Footnotes
- ...
- These are
called "Boolean" variables in reference to the notable 19th
century mathematician George Boole. Boole's greatest work
was entitled An Investigation of the Laws of Thought on
Which Are Founded the Mathematical Theories of Logic and
Probabilities, published in 1854. Boole reduced logic (the
analysis of the truth or falsity of complex propositions) to a
simple algebra, thereby incorporating logic into mathematics.
Boole's two-valued, or binary, algebra is the simplest form of
his more general boolean algebra.
- ...
- Technically, the result of applying
a C logical operator is of the particular C numeric data
type called int.
- ...
- Alcock rather misleadingly talks of certain
characters being stored in a certain "order" and/or
"contiguously"; what he means is that characters are encoded in a certain order or contiguously.
- ...
- Its actually even more complicated than this, but I
will spare you any further details!
- ...
- This
possibility is not pursued in detail by Alcock at this stage, but is
raised implicitly in Exercise 4 of the chapter.
- ...
- Note that the
names of separate variables must be textually different, even if
only "slightly" so.
- ...
- The prototype for
the exit() function is in the header file stdlib.h, so you
should #include this header at the top of your file if you
intend to use the exit() function.
- ...
- In particular,
you might have a look at the standard library facilities for "process
control" described in pagese 171-176 of Illustrating C
- though this is not for the faint hearted!
- ...
- In general when I refer to the name of a function
I include a pair of parentheses after the name, as in
main(). I adopt this convention so that, whenever I use a name,
you can easily tell whether it is intended as the name of a function
or of a variable. In fact, the compiler works much the same way: when
it sees a name in an expression, it looks to see whether the name is
followed by a left parenthesis, and, if so, it knows that the name is
supposed to refer to some function.
- ...
- I use the term
"sub-function" loosely in this kind of context to distinguish between
one "calling" function and a second function which is "called".
However, "sub-function" is not a technical term of the C language:
to C all functions are "equal" - there is no kind of
precise distinction between "functions" and "sub-functions".
- ...
- Note that the function for printing
out the result will not have to vary or be modified...
- ...
- A technical exception here is in the case of array arguments. C has some special rules for what happens
when an array name is used in an expression (without any index)
- such as when an array is specified as an argument. The nett
effect is that arrays "sort of" get passed by reference: but
the details of this are beyond the scope of the current
discussion.
- ...
- Both printf() and
scanf() are exceptions to this rule - they can deal with
varying numbers of arguments. But this is highly exceptional:
most of the library functions we deal with will only accept
fixed numbers of arguments; and all of the user defined
functions covered in this course will only accept fixed numbers
of arguments.
- ...
- Again,
printf() and scanf() are exceptions to this general
rule; but also again, it is beyond the scope of this course to
consider this very exceptional behaviour in any further
detail!
- ...
- In some cases, the prototype for a particular
function may be included in several different header files; in
such a case you just have to insure that at least one of them
is #include'd in your file.
- ...
- When I say that the name of the function
is "replaced" by the returned value, I do not, of course, mean
literally that the text of your program is altered. Rather I
mean that the way to understand what happens next at execution
time is to imagine the return value appearing in the place
occupied by the function name.
- ...
- Other functions may be "active" -
main() is active all the time, for example - but
be temporarily suspended while a sub-function is executing. Their
variables still exist, and will become visible again in the
Watch window as execution returns to them...
- ...
- OK: this is
a little white lie. It can be done, but only using the
mechanisms of struct data types. This is beyond the scope
of the current discussion, but have a browse in Chapter 8 of
Illustrating C if you want to explore this further...
McMullin@ugmail.eeng.dcu.ie
Wed Apr 12 19:40:14 BST 1995