Introduction of C Programming
Introduction of C
Introduction
❖ C is a general--purpose, high--level language developed by Dennis Ritchie at AT & T’s Bell Laboratories of USA in 1972.
❖ In the late seventies C began to replace the more familiar languages of that time like ALGOL, etc
❖ ANSI C standard emerged in the early 1980s.
❖ It was initially designed for programming UNIX operating system.
❖ Now the software tool as well as the C compiler is written in C.
❖ Major parts of popular operating systems like Windows, UNIX, Linux is still written in C.
❖ C is popular because it is reliable, simple and easy to use.
❖ often heard today is – “C has been already superceded by languages like C++, C# and Java.
❖ C has now become a widely used professional language for various reasons −
❑ Easy to learn
❑ Structured language
❑ It produces efficient programs
❑ It can handle low--level activities
❑ It can be compiled on a variety of computer platforms
Features of C
❖ Structured programming language. break the program into parts using functions
❖ Procedural Language : step by step predefined instructions are carried out
❖ Mid-level programming language : intended to do low-level programming, also supports the features of
a high-level language
❖ Rich set of built in Operators : We can create our own function and add to library.
❖ Fast and Efficient :
❖ Extensible : because it can easily adopt new features.
❖ Machine Independent or Portable : written once run on other machines with some machine specific
changes.
Structure of C
❖ Documentations (Documentation Section)
❖ Preprocessor Statements (Link Section)
❖ Global Declarations (Definition Section)
❖ The main() function
■ Local Declarations
■ Program Statements & Expressions
❖ User Defined Functions (Sub Program Section )
❖ 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 such as using the #include directive.
❖ Definition section: The definition section defines all symbolic constants such using the #define directive.
❖ 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
i. Declaration part: The declaration part declares all the variables used in the executable part.
ii. 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 brace and ends at the closing brace.
❖ 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: If the program is a multi-function program then 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.
wow,thanks mam helps a lot
ReplyDelete