You are on page 1of 6

Programming Language

Introduction

In computing, C is a general-purpose programming language initially developed by


Dennis Ritchie.
Like most imperative languages in the ALGOL tradition, C has facilities for
structured programming and allows lexical variable scope and recursion, while a
static type system prevents many unintended operations.

A Simple C Program
Example:
#include<stdio.h>
#include<conio.h>
int main ()
{
clrscr();
printf(“Welcome to C Language”);
getch();
return 0;
}

Output:
Welcome to C Language

In the above program:


The first line of the program contains a preprocessing directive, indicated by
“#include”
This is an instruction to the compiler (a program that translates C code into such
information that a computer can understand.
It tells the compiler that another file is needed to compile the program; in this
case, stdio.h and conio.h are used.
stdio.h is a standard input/output file that includes definitions for common input
and output methods.
conio.h is a header file used mostly by MS-DOS compilers to provide console
input/output.
The "main" has a couple of parentheses, which are an indication to the compiler
that this is a function.
The two curly brackets { }, properly called braces, are used to specify the limits of
the program itself.
“clrscr()” is used to clear the previous output screen.
“printf()” is used to print the contents of the parentheses, in this case: the output
is “Welcome to C Language”
In C, semi-colon (;) is used to signal to the compiler that a line is complete.
In this program getch() is just used to pause a program after it prints “Welcome to
C Language.”
Without this, the screen would just flash the statement and then close.
return
In C, functions often return values.
Some functions return numbers or characters.
The main() function should always return either zero or one.
This is what the program above will look like when it runs on your screen:
The History of C
C was developed at Bell Laboratories in 1972 by Dennis Ritchie.

In 1983, the American National Standards 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 in
1988.

Today C is in widespread use with a rich standard library of functions.

Why Use C?

Mainly because it produces code that runs nearly as fast as code written in
Assembly Language.

Many different kinds of software are written in C:

Language compilers and interpreter


Device drivers
Telecom applications
Network programming
Digital signal processing applications
Database applications
Text editors
Operating systems
Evaluation of C Programming
C is often called a "Pseudo high level language" or a "Middle level language."

This is not because of its lack of programming power but because of its capability
to access the system's low level functions.

C instructions are compiled to assembly code; therefore, depending on the


complexity of the code and on the compiler optimization capabilities, C code may
run as fast as assembly code.

C is prized for its efficiency, and is the most popular programming language for
writing system software.

Execution of C Programs

There are four steps for creating and executing a program in C:


Creating a Program:
Programs are often written using an Integrated Development Environment (IDE)
such as Microsoft Visual Studio.
Programs can be written using only a basic text editing program like notepad, but
Microsoft Visual Studio has many useful features, such as:

Debugging capabilities
An integrated compiler
Code navigation tools
Compiling the Program:
The next step is to compile the program.
A C compiler converts executable code to object code.
Object code consists of binary instructions for the computer to execute.

Linking a Program to a Library:

The object code of a program is linked with libraries that are needed for the
execution of a program.
The linker is used to link the program with libraries.
It creates a file with '.exe' extension.

Execution of the Program:

The final executable file is then run by the dos command prompt.
C Programming Advantages
C is a small, efficient, powerful and flexible language.
C is close to computer H/W (architecture).
C is standardized, making it more portable compared to other languages.
It contains libraries.

Many other languages borrow syntax from C syntax.

Example: Java, JavaScript, Perl.


The Future of C

C is an important language which will continue to be so.


Many other languages are based on C, so learning the principles of C help one
understand and learn additional languages.
C is a better option when it comes to programming device drivers, embedded
applications and utility programs.

You might also like