0% found this document useful (0 votes)
7 views14 pages

Overview of C Programming Language

Chapter 1 C Programming

Uploaded by

raja hello
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)
7 views14 pages

Overview of C Programming Language

Chapter 1 C Programming

Uploaded by

raja hello
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

Chapter 1 – Overview of C

History of C:
✓ The C programming language was designed by Dennis
Ritchie at Bell Laboratories in the early 1970s

✓Structured, High-level, machine-independent language


✓Root from ALGOL ( Algorithmic Language ) – First
computer language – Using block structure
✓Influenced by
✓ALGOL 60 (1960),
✓CPL - Combined Programming Language (Cambridge,
1963),
✓BCPL – Basic Combined Programming Language (Martin
Richard, 1967),
✓B – Features of BCPL – To create UINX (Ken Thompson,
1970)
✓C was evolved from ALGOL, BCPL and B.
✓Finally C released on 1972
 Traditional C
 In 1978 – More popular after publication of the book
“The C Programming Language” by Brian Kerningham
and Dennis Ritchie
 Referred as “K&R C”
❖Standardized in 1989 by ANSI (American National
Standards Institute) known as ANSI C
❖International Standard Organisation (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++ (1990) 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.
History of C
1960 ALGOL International Group

1967 BCPL Martin Richards

1970 B Ken Thompson

1972 Traditional C Dennis Ritchie


History of C

1978 K&R C Kernighan and Ritchie

1989 ANSI C ANSI Committee

1990 ANSI/ISO C ISO Committee


Importance of C
 Efficient and fast – due to its data types and operators
 32 keywords
 Highly portable
 Well structured programming
 Ability to extend itself – we can add our own functions to
C library
Basic Structure of C Programs
Documentation Section
Link Section
Definition Section
Global Declaration Section
main () Function Section
{
Declaration part
Executable part
}
Subprogram section
Function 1
Function 2
-
- ( User-defined functions )
Function n

 All sections, except the main function section may be absent when they are not required
 Documentation section:
 Consists of a set of comment lines like name of the
program, the author
 Link section:
 Provides instructions to the compiler to link functions from
the system library
 Definition section:
 Defines all symbolic constants
 Global Declaration section:
 Global variable are declared in global declaration section
i.e. outside of all the functions also declares all the user-
defined functions
Cont…
 Every C program must have one main() function
 It contains two parts
 Declaration part
 Executable part
 Declaration part:
Declares all the variables used in the executable part
 Executable part:
At least one statement in this part
 These two parts must appear between opening and closing
braces ({ } )
 The program execution begins at the opening brace and ends
at the closing braces
 The closing brace of the main function is the logical end of
the program
Cont…
 Subprogram section:
 Contains all the user-defined functions
 The functions are called in the main function
 Example Program:
/* Name: xxxxx */ Documentation Section
/*Program showing only printf statement*/
#include <stdio.h>
Link Section
#include <conio.h>
#define PI=3.14 Definition Section
int a=10;
void sum(); Global variable declaration Section
main()
Control Starts from here
{
Opening Brace
int count = 1;
Declaration part
printf(“ The pie value is = %f”, PI);
printf(“The value of a is = %d”,a); Executable part
sum();
}
Closing Brace
void sum() Subprogram Section
{ printf(“The value of a is=%d”,a);
Programming Style
 Writing program in lowercase letters
 C is a free form language, we can group statements
together on one line.
a=b;
x=y+1;
z=a+x;
Can be written in one line as
a=b; x=y+1; z=a+x;
Executing a ‘C’ program
 Creating the program
 Compiling the program
 Linking the program
 Executing the program

You might also like