22-11-2012, 03:39 PM
C Programming
C Programming.pdf (Size: 371.01 KB / Downloads: 27)
An Introduction to Computers
A device which processes information according to instructions it has been
given.
This general definition rules out fridges but is not exhaustive. However for our
purposes it will do. The instructions you give to the computer are often called a
program. The business of using a computer is often called programming. This
is not what most people do with computers. Most users do not write programs,
instead they talk to programs written by other people. We must therefore make
a distinction between users and programmers. A user has a job which he or she
finds easier to do on a computer running the appropriate program. A programmer has a masochistic desire to tinker with the innards of the machine.
One of the golden rules is that you never write your own program if there is
already one available, i.e. a keen desire to process words with a computer
should not result in you writing a word processor!
However, because you will often want to do things with computers which have
not been done before, and further because there are people willing to pay you to
do it, we are going to learn how to program as well as use a computer.
Before we can look at the fun packed business of programming though it is
worth looking at some computer terminology:
Hardware and Software
If you ever buy a computer you are not just getting a box which humms. The
box, to be useful, must also have sufficient built in intelligence to understand
simple commands to do things. At this point we must draw a distinction
between the software of a computer system and the hardware.
Hardware is the physical side of the system. Essentially if you can kick it, and it
stops working when immersed in a bucket of water, it is hardware. Hardware is
the impressive pile of lights and switches in the corner..
Data and Information
People use the words data and information interchangeably. They seem to think
that one means the other. I regard data and information as two different things:
Data is the collection of ons and offs which computers store and manipulate.
Information is the interpretation of the data by people to mean something.
Strictly speaking computers process data, humans work on information. An
example, the computer holds the bit pattern:
Data Processing
Computers are data processors. Information is fed into them, they do something
with it, and then generate further information. A computer program tells the
computer what to do with the information coming in. A computer works on
data in the same way that a sausage machine works on meat, something is put
in one end, some processing is performed, and something comes out of the
other end:
Putting in more detail
We now have a fairly good understanding of what our program is going to do
for us. Being sensible and far thinking people we do not stop here, we now have
to worry about how our program will decide when the information coming in is
actually valid.
This must be done in conjunction with the customer, he or she must understand
that if information is given which fits within the range specified, your program
will regard the data as valid and act accordingly.