|
C was developed in 1972 by Dennis Ritchie at AT & T Bell Laboratories. It is an outgrowth of an earlier languages called B language, which was also developed by AT & T Bell Laboratories. C was largely confined to use within Bell Laboratories until 1978, when Brian Kernighan and Ritchie published a definitive description of the language. The description is often referred "K & R C".
And after this there was no looking back, as more and more computer professionals switched over to C. Today there are C compilers available under every conceivable environment from DOS to windows to Unix , and on all size of computers from micros to mainframes.
The most important reasons for C's popularity are:
- Portability
- Flexibility
- Power
- Performance
The C language has the good machine efficiency as compared to Problem Oriented Language like COBOL and FORTRAN.
Why Use C ?
The main purpose of using C is, because it produces code that runs almost as fast as code written in assembly language. C language has been used in every type of programming problem imaginable from operating systems to spreadsheets to expert systems and efficient compiler are available for machines running in power from the Apple Macintosh to the Cray supercomputers.
The largest quantity of C's success looks to be based on purely practical considerations are:
- Compiler portability.
- The concept of standard library.
- A powerful and different types of operators.
- An elegant syntax.
- Prepare access to the hardware when needed.
- The simplicity with which applications can be optimized by hand-coding isolated processes.
Use Of C Language ?
C was initially used for system development works, in particular programs that make-up the operating system (OS).
Some examples are:
Operating Systems.
Language Compilers.
Assemblers.
Text Editors.
Print Spoolers.
Network Drivers.
Modern Programs.
Data Bases.
Language Interpreters.
Utilities.
Objective of C Language
C's character set
C's keywords
The general structure of a C program
That all C statement must end in a
That C is a free format language
All C programs us header files that contain standard library functions.
Character Set of C language
Those characters required by the C Programming Language are:
A - Z
a -z
0 - 9
space . , : ; ' $ "
# % & ! _ {} [] () < > |
+ - / * = |
The Form of C language
In any C program, it has consist of at least one function, usually to write a C program where comprises several functions. The only function that has to be present is the function called main. For more advanced programs themain function will act as a controlling function calling other functions in their turn to do the dirty work!. The main function is the first function that is called when your program executes.
Keywords of C Language
The C Language has 32 keywords, which are given bellows:
double auto int struct
break else long switch
case register typedef goto
char return union enom
const float short unsigned
continue for signed void
default sizeof volatile extern
do if static while |
The Layout of C programs
The general form of a C program is as follows:
pre-processor directives
global declarations
main()
{
local variables to function main ;
statements associated with function main ;
}
fun1()
{
local variables to function 1 ;
statements associated with function 1 ;
}
fun2()
{
local variables to function 2 ;
statements associated with function21 ;
}
.
.
. etc. |
Simple Example of C Language:
# include<stdio.h>
main()
{
printf ("Hello C Programing ! ");
} |
Output:
Note: Uses of bracket set () and {}: () are used in conjunction with function names whereas {} are used as to define the C statements that are related with that function. The semicolon (;) is used to terminate C statements. C programming language is a free format language and long statements can be continued, without truncation, onto the next line. The semicolon informs the C compiler that the end of the statement has been reached. Free format also means that you can add as many spaces as you like to improve the look of your programs. All pre-processor directives begin with a # and the must start in the first column:
# include <stdio.h > OR # include"stdio.h"
|