Docsity

C Programming-Overview of C, Slides of C programming

Partial preview of the text

Download C Programming-Overview of C and more Slides C programming in PDF only on Docsity!

B.Bhuvaneswaran, AP (SG) / CSE 9791519152 [email protected] Programming Logic

Overview of C

Basics of C Language

 C language was developed by Dennis Ritchie of Bell Laboratories in New Jersey in the year 1972.  The language was named as C because it was the successor of another language called B.

Compilers Vs Interpreters

History of ANSI C

Typical Structure of POP

Relationship of Data & Functions in POP

Basic Structure of C Programs

Documentation Section

 The documentation section consists of a set of comment lines giving the name of the program, the author and other details, which the programmer would like to use later.

Definition Section

 The definition section defines all symbolic constants.

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 the global declaration section that is outside of all the functions.  This section also declares all the user–defined functions.

main() function Section

 The declaration part declares all the variables used in the executable part.  There is at least one statement in the executable part.  These two parts must appear between the opening and the closing braces.  The program execution begins at the opening brace and ends at the closing brace.  The closing brace of the main function section is the logical end of the program.  All statements in the declaration and executable parts end with a semicolon(;).

Sub program Section

 The subprogram section contains all the user–defined functions that are called In the main function.  User–defined functions are generally placed immediately after the main function, although they may appear in any order.

Executing a C Program

 Executing a program written in C involves a series of steps. These are:

  • Creating the program;
  • Compiling the program;
  • Linking the program with functions that are needed from the C library; and
  • Executing the program.

Compiling and Running a C Program