5. C is a general purpose language which is very closely associated
with UNIX for which is was developed in Bell Laboratories.
Most of the Programs of UNIX are written and run with the help
of “C”.
Many of the important ideas of “C” stem are form BCPL by
Martin Richards.
In 1972, Dennies Ritchie at Bell Laboratories wrote C Language
which caused a revolution in computing world.
From beginning C was intended to be useful for busy
programmers to get things done easily because C is powerful,
dominant and supple language.
6.
7. Programming requires programming language:
• A set of words, codes and symbols that allow a
programmer to give instructions to the computer.
• Each languages has rules ( or Syntax) for writing the
instructions.
• There are many programming Languages so many!( Like
human Languages)
• They may be classified in many ways into THREE broad
categories:
1. Machine Language;
2. Assembly Language; and
3. High Level Language.
9. Fast, Powerful & efficient
Easy to learn
It is portable
“Mid-Level language
Widely accepted language
Useful for all applications
Easy to Connect with system devices/
assembly routines
10.
11. Before going and reading the structure of C programs
we need to have a basic knowledge of the following:
1. C’s Character Set (A-Z, a-z,0-9, symbols, space)
2. C’s Keywords (only lowercase)
3. The General Structure of a ‘C’ Program
4. How to End a Statement
5. Free Format Language
6. Header Files & Library Functions
13. Program Explanation
#include
This is a preprocessor command that comes as the first
statement in our code. The #include statement tells the
compiler to include the standard input/output library i.e.
stdio.h in the program.
main ()
C programs consist of one or more functions. There must be
one and only one function called main. The brackets following
the word main indicate that it is a functions an not a variable.
{}
Braces surround the body of the function, which may have one
or more instructions/statements.
14. Program Explanation
printf();
It is a library function that is used to print data on the user
screen.
“Hello World/n” is a string that will be displayed on user
screen /n is the newline character, ; a semicolon ends a
statement.
Return 0; return the value zero to the operating system.
C is case sensitive language, so the names of the functions
must be typed in lower case as above.
15. Constants
Constants in C are the fixed values that do not change during
the execution of a program.
16. Variables
Variables
A variables is a data name that is used to store any data
value.
Variables are used to store values that can be changed
during the program execution.
Variables in C have the same meaning as variables in
algebra. That is shown some unknown or variable, value.
x = a + b
z + 2 = 3 (y – 5)
Remember that variables in algebra are represented by
a single alphabetic character.
17. Program design tools that uses standard
graphical symbols to represent LOGICAL FLOW OF
DATA through a function/program.
Its primary purpose is to show the design of an
algorithm. It frees a programmer from the syntax and
details of programming to concentrate on details of
the problem to be solved.
It gives a Pictorial representation of an
algorithm—helps one to think of a problem
pictorially.