C is a general-purpose programming language developed in the 1970s. It combines high-level language features with low-level language efficiency and flexibility. C programs are portable, meaning they can run on many different computer systems. C laid the foundation for many other popular languages by providing core functionality like functions, arrays, structures, and pointers in a simple syntax that is efficient for systems programming tasks.
2. Cont..
• C is a general-purpose structured
programming language that is powerful,
efficient and compact.
• C combines the features of high-level
language with elements of the assembler and
thus, the close to both man and machine
(computer).
• C was developed and implemented at Bell
Laboratories in 1972 by Dennis Richie.
3. Cont..
• Important of C or features of C.
• It is a robust language whose rich set of built-in function and
operators can be used to write any complex program.
• The C compiler combines the capabilities of an assembly
language with the features of a high-level language and
therefore it was suited for writing both system software and
business packages. In fact, many of compilers available in
market are written in C.
• Program written in C are efficient and fast, this is due to
variety of data types and powerful operators.
• There are only 32 keywords and its strength lies in its in-built
functions. Several standard functions are available which can
be used for developing programs.
• C is highly portable, its means that C programs written for one
computer can be run on another with little or no modification.
4. Cont..
• C language is well suited structured programming,
thus required the user to think of a program in
terms of function modules or blocks. Proper
collections of these modules make a complete
program. This modular structure makes program
debugging, testing and maintenance easier.
• C is its ability to extend itself. A c program is
basically collection of functions that are supported
by the C library. We can continuously add our own
function to the c library. Thus with availability of
large number of functions, the programming task
becomes simple.
5. Cont..
• C Instructions:
• Type declaration instructions: used to declare types of variables
used in programs. E.g. int a;
• Input/output instructions: used to input data required by program
and information to be output on printer/screen. E.g. printf and scanf.
• Arithmetic Instructions: arithmetic instruction done between
constants and variables. Eg. Assignment statement.
• Control instructions: To maintain order of execution of different
statements control instruction are used. They are following types:
• Unconditional control statement e.g Goto statement.
• Decision control statement e.g. IF statement.
• Loop control statement e.g For and do statement.
• Case control statement .e.g Case statement.
6. Cont..
• Basic structure of C programs:
• 1. Documentation section: consists of a set of comments
lines giving the name of program, author and other detail
which programmer would like to use later.
• 2. Link section: this section provides instruction to compiler
to link function from system library.
• 3. Definition Section: this section defines all symbolic
constants.
• 4. Global Declaration section: there are some variables that
are used in more than one function. Such variables are called
global variables and are declared in global definition section
that is out side of all the functions.
7. Cont..
• 5. Main( ) function section: every c program must
have one main( ) function section and its divided in to
two part one is declaration part and executable part.
The declaration part declares all the variables used in
executable part. There is at least one statement in
executable part. And these two parts appear between
opening and closing braces ( { } ). All the statements in
the declaration and executable parts end with a
semicolon ( ; ).
• 6. Subprogram section: this section contains all the
user-defined functions that are called in the main
section. User-defined functions are generally placed
immediately after the main function, although they may
appear in any order.
8. C Program Characteristics
• Reliability: i.e the program can be depended upon always to
do what is supposed to do.
• Integrity: This refers to accuracy of the calculations. It should
be clear that all the other program enhancements would be
meaningless if the calculations were not carried out correctly.
• Clarity or Readability: It refers to the overall readability of
the program, with particular emphasis on its underlying logic.
If the program is written clearly, it should be possible for
another programmer to follow the logic without undue effort.
• Maintainability: i.e. the program will be easy to change or
modify when the need arises.
• Portability: i.e. the program will be transferable to different
computer with a minimum of modification.
9. Cont..
• Performance or Efficiency: i.e. the program causes the
tasks to be done quickly and efficiently. It also concerned with
execution speed and efficient memory utilization this aid
reliability, maintainability and portability.
• Storage saving: i.e. the program is not allowed to be
unnecessarily long.
• Modularity: Many programs can be decomposed into series
of identifiable sub tasks. It is good programming practices to
implement each of these subtasks as a separate module. (In
Pascal, such module refers as procedures and functions). The
use a modular programming structure enhances the accuracy
and clarity of a program, and it facilities future for program
alterations.
10. VARIABLES
• A variable is a named data storage
location in your computer’s memory.
• By using a variable’s name in your
program, you are, in effect, referring to the
data stored there.
11. VARIABLE NAMING
CONVENTION
• To use variables in your C programs, you must know
ho to create variable names in
• C,variables names must adhere to the following rules:
– The name can contain letters, digits, and the underscore
character(_).
– The first character of the name must be a letter. The
underscore is also a legal first character, but its use is not
recommended.
– Case matters (that is uppercase and lowercase letters).
Thus, the names count and Count refer to two different
variables.
– C keywords can’t be used as variable names. A keyword is
a word that is part of the C language.
12. Different Programming Language
• There are three different level of
programming languages. They are
• (1) Machine languages (low level)
• (2) Assembly languages
• (3) Procedure Oriented languages (high
level)
• (4) Fourth Generation languages (4 GLS)
13. Cont…
• (1) Machine Languages :-
• Computers are made of No. of electronic
components and they all are two – state
electronic components means they
understand only the 0 – (pulse) and 1 (non
– pulse).
• Therefore the instruction given to the
computer must be written using binary
numbers. 1and 0.
• Computers do not understand English or
14. Cont…
• (2) Assembly Languages :-
• As it was very tedious to understand and
remember 0’s representing numerous data
and instruction.
• So to resolve this problem mnemonics
codes were developed. For example add
isused as symbolic code to represent
addition. SUB is used for subtraction.
• They are the symbolic representation of
certain combination of binary numbers
15. Cont..
• Which represents certain actions as
computer understand only Machine
language instructions a program written in
Assembly Language must be translated
into Machine languages.
• Before it can be executed this translation if
done by another program called
assembler. This assembler will translate
mnemonic codes into Machine languages.
16. Cont…
• (3) Procedure Oriented Languages
• In earlier assembly languages assembler
programs produced only one Machine
languages instruction for every assembly
languages instruction.
• So to resolve this problem now assembler
were introduced. Which can produce
several machine level instructions for one
assembly language instruction.
• Thus programmer was relieve from the
17. Cont..
• These languages are also called high level
languages. Basic, Fortran, Pascal and
COBOL.
• The most important characteristic of high
level languages is that it is machine
independent and a program written in high
level languages can be run on any
computers with different architecture with
no modification or very little modification.
18. WHAT IS LANGUAGE
TRANSLATORS?
• As we know that computer understand
only the instruction written in the Machine
language. Therefore a program written in
any other language should be translated to
Machine language. For this purpose
special programs are available they are
called translators or language
processors. This special programs accept
the user program and check each
statement and produces a corresponding
19. Compiler
• A Compiler checks the entire program
written by user and if it is free from error
and mistakes then produces a complete
program in Machine language known as
object program.
• But if it founds some error in program then
it does not execute the single statement of
the program.
• So compiler translate whole program in
Machine language before it starts
20. Interpreters
• Interpreters performs the similar job like
compiler but in different way. It translates
(Interprets) one statement at a time and if
it is error – free then executes that
statement. This continues till the last
statement in the program has been
translated and executed.
• Thus Interpreter translates and executes
the statement before it goes to next
statement. When it founds some error in
21. Difference of Compiler –
Interpreter
• Error finding is much easier in Interpreter
because it checks and executes each
statement at a time. So wherever it fine
some error it will stop the execution.
• Where Compiler first check all the
statement for error and provide lists of all
the errors in the program.
• Interpreter take more time for the
execution of a program compared to
Compilers because it translates and
22. Cont…
• All programming languages can be divided
into two categories:
– Problem oriented languages or high
languages
– Machine oriented languages or Low Level
Languages
23. Problem oriented languages or
high languages
• Examples of languages falling in this
category are FORTRAN, BASIC, Pascal,
etc.
• These languages have been designed to
give a better programming efficiency,
faster program development. Generally
these languages have better programming
capability but they are less capable to deal
with hardware or Hardware related
programming.
24. Machine oriented languages or
Low Level Languages
• Examples of languages falling in this
category are Assembly language and
Machine Language.
• This languages have been designed to
give a better machine efficiency i.e. faster
program execution.
• Generally these languages have better
hardware programming capability but it is
very difficult and tedious to do create
complex application like and business