ME 181 - 1st Lecture On C - Student
ME 181 - 1st Lecture On C - Student
LECTURE # 01
COMPUTING BASICS
INTRODUCTION
Outline
Basic Structure
Executing of C program
Simple Example
Facts about C
C was invented to write an operating system called UNIX.
C is a successor of B language which was introduced
around the early 1970s.
The language was formalized in 1988 by the American
National Standard Institute (ANSI).
The UNIX OS was totally written in C.
Today C is the most widely used and popular System
Programming Language.
Today's most popular Linux OS and RDBMS MySQL have
been written in C.
Why Use C?
C was initially used for system development work,
particularly the programs that make-up the
operating system. C was adopted as a system
development language. Some examples of the use
of C might be:
Operating Systems
Network Drivers
Modern Programs
Databases
Utilities
Basic Structure of C Program
Documentation section
Link section
Definition section
Global declaration section
main () function section
{
Declaration part
Executable part
}
Subprogram section
Function 1
Function 2
Function 3
.
.
Function n
Basic Structure of C Program
Documentation Section
This section consists of comment lines which include the
name of programmer, the author and other details like
time and date of writing the program. Documentation
section helps anyone to get an overview of the
program.
Link Section
The link section consists of the header files of the
functions that are used in the program. It provides
instructions to the compiler to link functions from the
system library.
Basic Structure of C Program
Definition Section
All the symbolic constants are written in definition
section.
Global Declaration Section
The global variables that can be used anywhere in
the program are declared in global declaration
section. This section also declares the user defined
functions.
Basic Structure of C Program
main() Function Section
It is necessary have one main() function section
in every C program. This section contains two
parts, declaration and executable part. The
declaration part declares all the variables that
are used in executable part. These two parts
must be written in between the opening and
closing braces. Each statement in the
declaration and executable part must end with
a semicolon (;).
Execution of C Program
Step 1 : Edit
This is First Step i.e Creating and Editing
Program.
First Write C Program using Text Editor.