0% found this document useful (0 votes)
41 views17 pages

The C Programming Language: A Structured Language

The document provides an overview of the C programming language, highlighting its structured nature, modularity, and control structures that enhance program readability and maintainability. It traces the history of C from its early influences in the 1960s through its development at Bell Labs, standardization by ANSI, and its significance in systems programming. Additionally, it covers the basic structure of C programs, the execution process, and the role of translator programs such as assemblers, compilers, and interpreters in software development.

Uploaded by

dulalchandra314
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views17 pages

The C Programming Language: A Structured Language

The document provides an overview of the C programming language, highlighting its structured nature, modularity, and control structures that enhance program readability and maintainability. It traces the history of C from its early influences in the 1960s through its development at Bell Labs, standardization by ANSI, and its significance in systems programming. Additionally, it covers the basic structure of C programs, the execution process, and the role of translator programs such as assemblers, compilers, and interpreters in software development.

Uploaded by

dulalchandra314
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

The C Programming Language: A Structured

Language
C is a Structured programming
• Modularity: Programs are divided into smaller, manageable functions, allowing
for independent development and testing.
• Control Structures: C provides clear control structures like loops (for, while) and
conditionals (if, switch) to manage program flow logically.
• Top-Down Approach: Encourages starting with high-level functions and breaking
them down into detailed implementations, aiding in complexity management.
• Clear Flow of Control: Ensures that program execution is explicit and easy to
follow, simplifying debugging and maintenance.
• Ease of Maintenance: Structured design enhances readability and
maintainability, reducing complexity and errors.
• Function-Based Design: Promotes reusability and logical separation of tasks,
reinforcing the structured approach
1
The C Programming Language (History)
• 1. Early Influences: BCPL and B
• 1960s: The origins of C can be traced back to languages developed in the
1960s, specifically BCPL (Basic Combined Programming Language), created
by Martin Richards in 1966.
• It was designed for writing system software and provided low-level access to
memory.
• Ken Thompson and B: In 1969, Ken Thompson developed the B programming
language at Bell Labs while working on the UNIX operating system.
• B was based on BCPL and adapted to be a simpler language that could run on
minicomputers with limited memory.

2
The C Programming Language (History)
• 2. Creation of C at Bell Labs
• 1970-1972: The B language had limitations in terms of data types and
functionality.
• To overcome these, Dennis Ritchie at Bell Labs began developing C by
expanding and improving upon B.
• C introduced richer data types, structures, and efficient operations, making it
well-suited for both system programming and general-purpose programming.
• 1972: C was fully implemented on a DEC PDP-11 machine.
• Ritchie and his colleagues used C to rewrite the UNIX kernel, replacing
assembly language with a higher-level language that provided portability and
efficiency.

3
The C Programming Language (History)
• 3. Early Adoption and Spread of C
• 1973: After the UNIX kernel was rewritten in C, UNIX and C became closely
linked, leading to the rapid adoption of both.
• Late 1970s: C began to gain popularity outside of Bell Labs, especially in
universities and research institutions.
• 4. Standardization: The ANSI C Standard
• 1983: The American National Standards Institute (ANSI) established a
committee, X3J11, to formalize the C language and create an official standard.
• 1989: ANSI introduced the ANSI C standard (also known as C89 or ANSI C).
• 990: The International Organization for Standardization (ISO) adopted ANSI C
as ISO C (ISO/IEC 9899:1990)
• 5. Further Revisions and C Standard Updates
4
History of ANSI C 5
Characteristics of C
• Structured Language: Supports breaking down programs into functions,
improving readability and modularity.
• Low-Level Access: Allows direct access to memory and hardware, making it ideal
for system programming.
• Rich Set of Operators: Includes a wide range of operators for arithmetic, logic,
and bit manipulation.
• Standard Library: Provides a set of library functions for handling input/output,
math operations, and more.
• Portable: C code can run on various systems with minimal adaptation.
• Efficient Memory Management: Offers functions like malloc() and free() for
manual memory control.
• Extensibility: New functions and libraries can be added as needed.

6
Importance of C

• Efficiency: C is close to hardware, allowing fine control over memory and


CPU usage, making it highly efficient.
• Portability: Code written in C is easy to transfer across different platforms
with minimal changes.
• Versatility: C can be used for system programming, embedded systems,
application development, and more.
• Foundation for Other Languages: Many modern languages like C++, Java,
and Python are influenced by C.
• Widely Used for Systems Programming: C is used to develop operating
systems, drivers, and other performance-critical software.

7
Sample C Program Format

8
Sample C Program Format
• The main is a part of every C program.
• C permits different forms of main statement.
• Following forms are allowed-
• main()
• int main()
• void main()
• main(void)
• void main(void)
• int main(void)

9
Sample C Program
//Author Hasan, Date: , Example.c

#include <stdio.h>

int main() {
printf(“Welcome to CSE Department\n");

return 0;
}

10
Basic Structure of a C Program

11
Executing a C program

Executing a program written in C involves


a series of steps.
1. Creating the program;
2. Compiling the programming
3. Linking the Program with functions that
are needed from the C library
4. Executing the Program

12
Executing a C program with Multiple Files

13
Translator Program
• Translator program is an • The main types of
essential tool in programming translator programs are
and software development that
• Convert code written in one
programming language into Assemblers
another,
• Typically into a lower-level
language that a computer can
understand and execute.
Interpreter Compilers

14
Translator Program
• 1. Assemblers
• Definition: Converts assembly language into machine code.
• Function: Translates symbolic instructions to binary.
• Output: Machine code specific to hardware.
• Use Cases: Systems programming and embedded systems.
• 2. Compilers
• Definition: Translates high-level programming languages into machine code or
intermediate code.
• Function: Analyzes, optimizes, and generates an executable file.
• Output: Executable binary file.
• Phases: Lexical analysis, syntax analysis, semantic analysis, optimization, code
generation.
• Use Cases: Application and system software development.

15
Translator Program
• 3. Interpreters
• Definition: Translates high-level languages into machine code line-by-line at
runtime.
• Function: Executes commands directly without generating an intermediate file.
• Output: Immediate execution of high-level code.
• Advantages: Easier debugging and interactive programming.
• Disadvantages: Generally slower than compiled programs.
• Use Cases: Scripting languages and rapid development.

16
Software Development Life Cycle (SDLC)

SDLC is a structured process followed by


software developers and teams to plan,
design, develop, test, and deploy
software applications

17

You might also like