Lecture – 1
Definition of Programming: Programming is writing instruction for a machine specially a
computer. The machine which works differently according to the instructions given to it is called
a programmable machine. The job of this machine is not fixed. We can change the working plan
of the machine by changing the instructions or programs according to our requirements.
Language: Instructions given to computer have a particular format. Computers are unable to
understand human language. There are several levels of format or language which a computer can
understand.
Low Level Language: Machine language, Assembly language.
Mid Level Language: Bytecode generated by Java.
High Level Language: C, Pascal, COBOL.
Algorithm: The approach or method that is used to solve the problem is known as an algorithm.
So if we were to create a program that tests if a number is odd or even
• The method that is used to test of the number is even or odd is the algorithm.
To write a program, you need to write the instructions necessary to implement the algorithm. These
instructions would be expressed in the statements of a particular computer language, such as Java,
C, C++.
So, Algorithm is defined as any special method of solving a certain problem. But in computer it
has a special meaning. It means step by step procedure to solve a problem by a computer. An
algorithm has following properties:
i) An algorithm must be composed of finite number of steps. Each step may be another
algorithm composed of several steps.
ii) Each step of algorithm must be definite. You cannot say add 2 or 3 to x.
iii) The steps must be effective.
iv) The algorithm may have one or more inputs but it must have at least one output.
v) An algorithm must terminate after a finite number of operations. Without termination it
can be a computational procedure. An operating system of digital computer is an example
of a computational procedure since it does not terminate, but contains in a waiting state
until a new job is entered.
Programming tools for expressing algorithm:
i) Flow Chart:
a) Start / End
b) Process / operation
c) Decision block
d) I/O
Writing a program: The act of writing a C program can be broken down into multiple steps
History of C language: C was invented and first implemented by Dennis Ritchie on a Dec PDP11
using the UNIX operating system. C is the result of a development process that started with an
older language called BCPL developed by Martin Richards. BCPL influenced a language called B
which was invented by Ken Thompson and which led to the development of C in the 1970s.
ANSI (American National Standard Institute) C is formed in 1980.
Features of C: It is a robust language with rich set of built-in functions and operators that can be
used to write any complex program. The C compiler combines the capabilities of an assembly
language with features of a high-level language. Programs Written in C are efficient and fast. This
is due to its variety of data type and powerful operators. C is highly portable this means that
programs once written can be run on another machines with little or no modification. A C program
is basically a collection of functions that are supported by C library. We can also create our own
function and add it to C library. C language is the most widely used language in operating systems
and embedded system development today.