Advertisements

Showing posts with label "C" language. Show all posts
Showing posts with label "C" language. Show all posts

Tuesday, November 13, 2018

Basic Structure of "C" Program.

To write a C program, we first create functions and then put them together. A 'C' program may contain one or more sections. They are illustrated below.


  • 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.
  • Link Section : The link section provides instructions to the compiler to link functions from the system library.
  • 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 :  Every C program must have one main function section. This section contains two parts; declaration part and executable part.
  • Declaration Part : The declaration part declare all the variables used in the executable part.
  • Executable Part : There is at least one statement in the executable part. These two parts must appear between the opening and closing braces. The program execution begins at the opening braces and ends at the closing braces. The closing brace of the main function is the logical end of the program. All statements in the declaration and executable part end with a semicolon.
  • Subprogram 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.
All section, expect the main() function section may be absent when they are not required.

Sunday, November 11, 2018

''C'' language : History of "C" language | Why name "C" was given to Language?

Definition & History of "C" Language :
        C is a general-purpose language which has been closely associated with the UNIX operating system for which it was developed - since the system and most of the programs that run it are written in C.



        Many of the important ideas of C stem from the language BCPL, developed by Matrin Richard. The influence of BCPL on C proceeded indirectly through the language B, which was written by Ken Thompson in 1970 at Bell Labs, for the first UNIX system on a  DEC PDP-7. BCPL and B are "type less" languages whereas C provides a variety of data types.

        In 1972 Dennis Ritchie at Bell Labs writes C and in 1978 the publication of The C Programming Language by Kernighan & Ritchie caused a revolution in the computing world.
Dennis Ritchie


Brian Kernighan


        In 1983, the America National Standard Institute (ANSI) established a committee to provide a modern, comprehensive definition of C. The resulting definition, the ANSI standard, or "ANSI C", was completed late 1988.

Why name "C" was given to Language?

  • Many of C's principles and ideas were derived from the earlier language B. (Ken Thompson was the developer of B Language.)
  • BCPL and CPL are the earlier ancestors of B Language
  • CPL is common Programming Language. In 1967, BCPL Language (Basic CPL) was created as a scaled down version of CPL.
  • As many of the features were derived from "B" Language that's why it was named as "C".
  • After 7-8 years C++ came into existence which was first example of object oriented programming.
C Programming Language Timeline