Tutorial 1
Introduction to C Programming
Tutorial 1
Session Objective
• History of C language
• Benefits
• Common Terms for programmer
• Compilation Process
• Structure of Programming
Tutorial 1
Introduction
• C programming language was developed 1972 by Dennis
Ritchie in Bell Laboratories.
• It’s an offspring of “Basic combined programming” called ‘B’
which was developed by Ken Thomson
• B language was interpreter-based but it was very slow
• So Dennis Ritchie modified the ‘B’ language and named it
as ‘C’
• Everything before this is known as “K&R C”
Tutorial 1
History
• Standardized in 1989 by ANSI (American National
Standards Institute) known as ANSI C
• International standard (ISO) in 1990 which was
adopted by ANSI and is known as C89
• As part of the normal evolution process the
standard was updated in 1995 (C95) and 1999
(C99)
• C++ and C
– C++ extends C to include support for Object
Oriented Programming and other features that
facilitate large software development projects
– C is not strictly a subset of C++, but it is
possible to write “Clean C” that conforms to
both the C++ and C standards.
Tutorial 1
Benefits
• C programs are efficient, fast & Highly portable
• It can be written in one computer and can be run
in another computer without any Modification.
• Its easy for debugging, testing & maintenance
because of structured programming
• Functions can be used many Number of building
blocks
Tutorial 1
Common Terms for Programmer
• Compiler
• Interpreter
• Assembler
• Linker
• Loader
Tutorial 1
Compiler
• A compiler is a computer program (or set of
programs) that transforms source code written in a
computer language (the source language) into
another computer language (the target language,
often having a binary form known as object code).
• The most common reason for wanting to transform
source code is to create an executable program.
• The name "compiler" is primarily used for programs
that translate source code from a high-level
programming language to a lower level language
(e.g., assembly language or machine code).
Tutorial 1
Interpreter
• An interpreter translates some form of source
code into a target representation that it can
immediately execute and evaluate
• Translates source code into some efficient
intermediate representation (code) and
immediately executes this
• Provides color coding in the program which helps
in self debugging while writing programs
Tutorial 1
Compiler vs. Interpreter
• A complier converts the high level instruction into
machine language while an interpreter converts
the high level instruction into an intermediate
form.
• Before execution, entire program is executed by
the compiler whereas after translating the first
line, an interpreter then executes it and so on.
• List of errors is created by the compiler after the
compilation process while an interpreter stops
translating after the first error.
• Compiler executes program faster as compared to
interpreter
Tutorial 1
Assembler
• An assembler is a program that takes basic
computer instructions and converts them into a
pattern of bits
• The assembler program takes each program
statement in the source program and generates a
corresponding bit stream or pattern
• The output of the assembler program is called the
object code
• The sequence of 0's and 1's that constitute the
object program is sometimes called machine code
Tutorial 1
Linker
• Linker is a program that takes one or more
objects generated by a compiler and combines
them into a single executable program
• The compiler automatically invokes the linker as
the last step in compiling a program.
Tutorial 1
Loader
• Responsible for loading the program
• It places programs into memory and prepares
them for execution
• Loading a program involves reading the contents
of executable file, the file containing the program
text, into memory, and then carrying out other
required preparatory tasks to prepare the
executable for running
Tutorial 1
Compilation Process
Tutorial 1
Structure of Programming

C programming

  • 1.
  • 2.
    Tutorial 1 Session Objective •History of C language • Benefits • Common Terms for programmer • Compilation Process • Structure of Programming
  • 3.
    Tutorial 1 Introduction • Cprogramming language was developed 1972 by Dennis Ritchie in Bell Laboratories. • It’s an offspring of “Basic combined programming” called ‘B’ which was developed by Ken Thomson • B language was interpreter-based but it was very slow • So Dennis Ritchie modified the ‘B’ language and named it as ‘C’ • Everything before this is known as “K&R C”
  • 4.
    Tutorial 1 History • Standardizedin 1989 by ANSI (American National Standards Institute) known as ANSI C • International standard (ISO) in 1990 which was adopted by ANSI and is known as C89 • As part of the normal evolution process the standard was updated in 1995 (C95) and 1999 (C99) • C++ and C – C++ extends C to include support for Object Oriented Programming and other features that facilitate large software development projects – C is not strictly a subset of C++, but it is possible to write “Clean C” that conforms to both the C++ and C standards.
  • 5.
    Tutorial 1 Benefits • Cprograms are efficient, fast & Highly portable • It can be written in one computer and can be run in another computer without any Modification. • Its easy for debugging, testing & maintenance because of structured programming • Functions can be used many Number of building blocks
  • 6.
    Tutorial 1 Common Termsfor Programmer • Compiler • Interpreter • Assembler • Linker • Loader
  • 7.
    Tutorial 1 Compiler • Acompiler is a computer program (or set of programs) that transforms source code written in a computer language (the source language) into another computer language (the target language, often having a binary form known as object code). • The most common reason for wanting to transform source code is to create an executable program. • The name "compiler" is primarily used for programs that translate source code from a high-level programming language to a lower level language (e.g., assembly language or machine code).
  • 8.
    Tutorial 1 Interpreter • Aninterpreter translates some form of source code into a target representation that it can immediately execute and evaluate • Translates source code into some efficient intermediate representation (code) and immediately executes this • Provides color coding in the program which helps in self debugging while writing programs
  • 9.
    Tutorial 1 Compiler vs.Interpreter • A complier converts the high level instruction into machine language while an interpreter converts the high level instruction into an intermediate form. • Before execution, entire program is executed by the compiler whereas after translating the first line, an interpreter then executes it and so on. • List of errors is created by the compiler after the compilation process while an interpreter stops translating after the first error. • Compiler executes program faster as compared to interpreter
  • 10.
    Tutorial 1 Assembler • Anassembler is a program that takes basic computer instructions and converts them into a pattern of bits • The assembler program takes each program statement in the source program and generates a corresponding bit stream or pattern • The output of the assembler program is called the object code • The sequence of 0's and 1's that constitute the object program is sometimes called machine code
  • 11.
    Tutorial 1 Linker • Linkeris a program that takes one or more objects generated by a compiler and combines them into a single executable program • The compiler automatically invokes the linker as the last step in compiling a program.
  • 12.
    Tutorial 1 Loader • Responsiblefor loading the program • It places programs into memory and prepares them for execution • Loading a program involves reading the contents of executable file, the file containing the program text, into memory, and then carrying out other required preparatory tasks to prepare the executable for running
  • 13.
  • 14.