“C Language “
Definition of Computer:- A Computer is a electronic device that can
performance a variety of operation in accordance with a set of instructions
called program.
Difference between computer and calculator:- Using
calculator we can perform only arithmetic operation where using computer we can
perform arithmetic as well as logical operation.
O.S.:- (Operating System):- It is an interface between user
and computer which makes computer comfortable
with user (means check all connected H/W) and provide interface (Eg.
Promopt /desktop).
Note:- format =deleing the data + creation FAT.
FATàFile Allocation Table.
Software: - Dos, Windows, UNIX, Linux
Hardware: - BIOS (basic input
output system).
Language: - it is a way of communication between two
persons.
Computer Language: - it’s a way of communication between
user and computer.
Programming language: - it is a special language with
special symbol and instruction which is used to communicate with computer. It
is also used for developing computer based application or software.
There are three categories of
computer language
·
Low level :-
Assembly, machine(0,1)
·
Middle
level: - C, C++.
·
High
level : - BASIC, COBOL, PASCAL,
FORTRAN, JAVA, PL/SQL…..
High level programming language: - if any programming
language synthetically similar to English and easy to understand called high
level programming language.
Ø
By using high level programming language we can
developed user interface applications
Low level programming language: -
In this programming language, we
have to need of given instruction in symbol format and it is not easy to
remember all instruction.
Ø
By using low level programming language we can develop
system software components.
Ø
Low level programming language also called
assembly language.
Note: C is also called system language.
Window
(95, 98, 2000, xp) O.S.
Ms
Office
FoxPro DBMS
Visual
FoxPro DBMS
Oracle RDBMS
Sol
server RDBMS
Page
maker
Coral
draw
VB, VC,
Internet
Explorer
Note: All above this software are designed in “C”.
Introduction of “C”:-
1) “C”
is a general purpose programming language.
2) “C”
is a middle level language programming language.
Ø
If any language reduce the gap between High
level programming language &Low level programming language that is known as
middle level programming language.
3) “C”
is a structure oriented programming language.
Ø
If any programming language design in top down
approach with block format is called structure oriented programming language.
4) “C”
is a procedure oriented programming language.
Ø
Dividing an application in module format. These
module formats are called procedure oriented programming language.
5) “C”
is a case sensitive programming language.
Ø
If any language define difference between upper
case letter and lower case letter known as case sensitive programming language.
6) “C”
is a platform dependent programming language.
7) “C”
is a top down programming language.
8) Every
statement in “C” program should be ended or terminated with semicolon (;).
History of C Language:-
Year of Establishment
|
Language Name
|
Developed By
|
1960
|
ALGOL-60
|
Cambridge University
|
1963
|
CPL (Combined Programming Language)
|
Cambridge University
|
1967
|
BCPL (Basic Combined Programming Language)
|
Martin Richard at Cambridge University
|
1970
|
B
|
Ken Thompson at AT & T's Bell Laboratories.
|
1972
|
C
|
Dennis Ritchie at AT & T' Bell Laboratory.
|
The development of C was a cause of
evolution of programming languages like Algol 60, CPL (Combined Programming
Language), BCPL (Basic Combined Programming Language) and B.
·
Algol-60 : (1963) :
ALGOL is an
acronym for Algorithmic Language. It was the first structured procedural
programming language, developed in the late 1963s and once widely used in
Europe. But it was too abstract and too general structured language.
·
CPL : (1963) :
CPL is an
acronym for Combined Programming Language. It was developed at Cambridge
University.
·
BCPL : (1967) :
BCPL is an
acronym for Basic Combined Programming Language. It was developed by Martin
Richards at Cambridge University in 1967. BCPL was not so powerful. So, it was
failed.
·
B : (1970) :
B language was
developed by Ken Thompson at AT & T Bell Laboratories in 1970. It was
machine dependent. So, it leads to specific problems.
·
C : (1972) :
'C' Programming
Language was developed by Dennis Ritchie at AT & T Bell Laboratories in
1972. This is general purpose, compiled, structured programming language.
Dennis Ritchie studied the BCPL, then improved and named it as 'C' which is the
second letter of BCPL
Syntax: - the grammar of any
programming language is called syntax. It should be terminated with semicolon
(;).
Structure of C Program:-
The basic structure of C
program is as follow:
Document Section
Links Section (File)
Definition Section
Global variable declaration Section
void main()
{
Variable declaration section
Function declaration section
executable statements;
}
Variable declaration section
Function declaration section
executable statements;
}
Function definition 1
---------------------
---------------------
Function definition n
Where,
Document Section: It consists of set of comment lines
(*/ /*) which include name of a program,
author name, creation date and other information.
Links Section (File):
Ø
It is used to link the required system libraries
or header files to execute a program.
Ø
It established connection between “C” program to
“C” libraries.
Syntax: - #include<header_file.h>
Ø
“C” library is collection of header files, every
header files is collection of pre-define functions.
Ø
“C” library containing 27 header files with 400+
pre-define functions.
Ø
Header file mainly classified into two types.
1)
Pre-define header file.
2)
User define header file.
Ø
Pre –define header file is collection of pre
define factions.
Ø
User define header file is collection of user
define function.
Ø
# include
is a pre-processor directive which can be used to include pre-define function
of given header file into current “C” program before compilation.
Ø
One program contains any number of # include statements but it’s should be
the first statement of “C” program.
void main() :
Ø
It is also known as main function or main block.
Ø
Used to start of actual C program. It includes
two parts as declaration part and executable part.
Ø
Main function is a staring executive block of
“C” program that means O.S will execute “C” program which are written inside
the main () function and it neglects the statement which are written outside
from the main() function.
Ø
Main () function is a heart of “C” program,
without main () program can be compile but cannot be execute.
Syntax:
- main()
{
}
Ø
Return type represent what type of value the
main () can able to return to the operating system. It can be any primitive
data type or void.
Ø
One “C” program should be containing maximum one
main ().
Variable declaration section: Used to declare variable.
Function declaration section: Used to declare functions of
program from which we get required output.
Then, executable statements are
placed for execution.
Function definition section: Used to define functions which
are to be called from main ().
Note:- main() function is user define function but name is
predefine.
Ø Out
of above sections link and main () sections are mandatory. And other sections
are optional section.
No comments:
Post a Comment