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...
- ...
- If you manage this
successfully, you should be able to see the new directory listed by
File Manager - for example as D:
MYDIR or
whatever.
- ...
- You will have to
"format" the diskettes first. Disk formatting and file
copying and deleting operations are all carried out with the File Manager: again, consult the online help for details!
- ...
- Login as "opac".
- ...
- This will be DemoA, DemoB,
DemoC or DemoD, where the last letter is the letter of
your section in the class.
- ...
- Note that you can specify multiple recipients for a
mail message by separating them by commas, and you can send mail to
yourself, though it will not be visible until you exit Mail and
re-enter it again.
- ...
- If
you did not do this in advance - shame on you. Do it now!
- ...
- If this directory already exists you can leave
it there, but delete all files and/or subdirectories which may be in
it.
- ...
- I strongly discourage the use of multiple edit
windows simultaneously accessing the same file: this
usually ends in tears! In fact, at this stage in your programming
education, you would do well to restrict yourself to a maximum of 3
simultaneous edit windows (even accessing different files), at any
given time.
- ...
- A
slightly more sophisticated, and convenient, alternative, is to display
the Output window (select the Output menu item on the
Window menu). This is a normal Turbo-C++ IDE window which can be
moved around and resized etc., but which "mirrors" whatever output
appears on the User Screen. Thus, it can allow you to still see
the output even while the User Screen itself is not being
displayed.
- ...
- Most people have a natural
disinclination to be severe in testing their own work - but
relish the thought of demonstrating the flaws in the work of
somebody else. Sad but true - and, in this case, rather
useful.
- ...
- The maximum size stipulated
in the textbook is 100 by 100; but with the Turbo-C++ application,
as currently configured, this is too large for it to handle. Hence the
reduction to 50 by 50.
- ...
- You
should have found that, if you click on the hot-linked file names, you
can get a display of either of these files, within Mosaic. You can,
of course, retype each program from this display into the
Turbo-C++ IDE.
However, you may also save the files directly from Mosaic, using the
Save As menu item on the File menu. Which saves a bit of
typing.
- ...
- If this still doesn't kill the
program, then you will probably have to use the Reset button on
the computer system unit, in order to reset the whole computer. But
the reset procedure is quite slow, and, of course, you will lose any
modifications to files which have not been saved to disk again.
So this is a very last resort!
- ...
- This strategy might run into difficulty if we were
concerned, for whatever reason, to only use as much memory as absolutely
necessary. Fortunately, this does not apply to the current exercise.
- ...
- This is actually a very general point in C:
anywhere a single statement can be legally used, then a whole set of
statements, enclosed in braces, can be used instead.
- ...
- Be warned: when
using scanf() to read values into a variable of type
double, the correct format specification is %lf rather
than %f; but, paradoxical as it seems, you should still use
%f as the format specification for printing values of
type double with printf().
- ...
- You should have
found that, if you click on the hot-linked file name, you can get a
display of the file, within Mosaic. You can, of course, retype the
program from this display into the Turbo-C++ IDE.
However, you may also save the
file directly from Mosaic, using the Save As menu item on the
File menu.
- ...
- Think carefully about the selection of test cases.
For example do you expect there to be some biggest numbers for which
the HCF() function will work? Smallest numbers? Should it work
if either of the arguments is zero? Should it work for negative
arguments? Does it matter which argument is given first - the bigger
or the smaller? And so on...
- ...
- That is, using something
like #define KEY 5, or const int key = 5. See page 34 of
Illustrating C.
- ...
- Technically, under the various idealizing assumptions we
have made, it can be shown that the trajectory will be parabolic.
- ...
- This change
will, of course, be negative, because
is negative; to put that
another way, what goes up must come down!
- ...
- That is: both a and A should contribute
to the count for the letter "a"; and non-alphabetics should not
contribute to any count.
- ...
- LaTeX is a typesetting
mark-up language, particularly suitable for hierarchically organised
documents, and documents using mathematical notation extensively. It
is a de-facto standard in academic publishing. A LaTeX source file is
still a form of ASCII, but with typesetting commands interspersed with
the "raw" text. It can be read with any tool which can display ASCII
files.
- ...
- Alternatively,
you might want to install a copy of the
Programmer's File
Editor. This is a
powerful (and free!) professional text editor for Windows. It does the
same job as NotePad, but much better!
McMullin@ugmail.eeng.dcu.ie
Wed Mar 15 10:20:49 GMT 1995