Introduction To C Prog.

Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

BCCA Sem-I Programming in C 2020-21

PROGRAMMING IN C

what is computer language?

A computer language is a method of communication with a computer.


A Computer language includes various languages that are used to
communicate with a computer machine. Some of the languages like
programming language which is a set of codes or instructions used for
communicating the machine. Machine code is also considered as a computer
language that can be used for programming.
The computer language is defined as code or syntax which is used to write
programs or any specific applications. The computer language is used to
communicate with computers. Broadly the computer language can be classified
into three categories assembly language, machine language, and high-level
language.

What is program in Computer?


In computing, a program is a specific set of ordered operations for a computer to
perform. The computer gets one instruction and performs it and then gets the next
instruction. Computer program, detailed plan or procedure for solving a
problem with a computer; more specifically, an unmistakable, ordered sequence
of computational instructions necessary to achieve such a solution.

In computing, a program is a specific set of ordered operations for a computer to


perform. Typically, the program is put into a storage area accessible to the
computer. The computer gets one instruction and performs it and then gets the
next instruction. The storage area or memory can also contain the data that the
instruction operates on. (Note that a program is also a special kind of "data" that
tells how to operate on "application or user data.")

To create a program, write it using some kind of computer language. Language


statements or code are the source program then "compile" the source program
(with a special program called a language compiler) and the result is called
an object program (not to be confused with object-oriented programming). There
are several synonyms for object program, including object module and compiled
program. The object program contains the string of 0s and 1s called machine
language that the logic processor works with.

Compiler
Source Code Object Code
Interpreter

1
BCCA Sem-I Programming in C 2020-21

Compiler and Interpreter


Compliers and interpreters are programs that help convert the high-level language
(Source Code) into machine codes to be understood by the computers. Computer
programs are usually written on high level languages. A high-level language is
one that can be understood by humans. To make it clear, they contain words and
phrases from the languages in common use – English or other languages for
example. However, computers cannot understand high level languages as we
humans do. They can only understand the programs that are developed in binary
systems known as a machine code. To start with, a computer program is usually
written in high level language described as a source code. These source codes
must be converted into machine language and here comes the role of compilers
and interpreters.

Compiler

To start with, a compiler creates the program. It will analyze all the language
statements to check if they are correct. If it comes across something incorrect, it
will give an error message. If there are no errors spotted, the compiler will convert
the source code into machine code. The compiler links the different code files
into programs that can be run such as exe. Finally the program runs.

Interpreter

An interpreter creates the program. It neither links the files nor generates machine
code. The source statements are executed line by line while executing the
program.

Difference Between
Interpreter translates just one statement Compiler scans the entire program and
of the program at a time into machine translates the whole of it into machine
code. code at once.
An interpreter takes very less time to A compiler takes a lot of time to
analyze the source code. However, the analyze the source code. However, the
overall time to execute the process is overall time taken to execute the
much slower. process is much faster.
An interpreter does not generate an A compiler always generates an
intermediary code. Hence, an intermediary object code. It will need
interpreter is highly efficient in terms further linking. Hence more memory is
of its memory. needed.

2
BCCA Sem-I Programming in C 2020-21

Introduction to C Programming Language

What is C programming?

C is a general-purpose programming language that is extremely popular, simple


and flexible. It is machine-independent, structured programming language which
is used extensively in various applications.

C was the basic language to write everything from operating systems (Windows
and many others) to complex programs like the Oracle database, Git, Python
interpreter and more.

It is said that 'C' is a mother of all programming languages. One can say, C is a
base for the programming. If you know 'C,' you can easily grasp the knowledge
of the other programming languages that uses the concept of 'C'

History of C language

The base or father of programming languages is 'ALGOL.' It was first introduced


in 1960. 'ALGOL' was used on a large basis in European countries. 'ALGOL'
introduced the concept of structured programming to the developer community.
In 1967, a new computer programming language was announced called as 'BCPL'
which stands for Basic Combined Programming Language. BCPL was designed
and developed by Martin Richards, especially for writing system software. This
was the era of programming languages. Just after three years, in 1970 a new
programming language called 'B' was introduced by Ken Thompson that
contained multiple features of 'BCPL.' This programming language was created
using UNIX operating system at AT&T and Bell Laboratories. Both the 'BCPL'
and 'B' were system programming languages.
In 1972, a great computer scientist Dennis Ritchie created a new programming
language called 'C' at the Bell Laboratories. It was created from 'ALGOL', 'BCPL'
and 'B' programming languages. 'C' programming language contains all the
features of these languages and many more additional concepts that make it
unique from other languages.

Where is C used? Key Applications

1. 'C' language is widely used in embedded systems.


2. It is used for developing system applications.
3. It is widely used for developing desktop applications.
4. Most of the applications by Adobe are developed using 'C' programming
language.
5. It is used for developing browsers and their extensions. Google's
Chromium is built using 'C' programming language.
6. It is used to develop databases. MySQL is the most popular database
software which is built using 'C'.
3
BCCA Sem-I Programming in C 2020-21

7. It is used in developing an operating system. Operating systems such as


Apple's OS X, Microsoft's Windows, and Symbian are developed using
'C' language. It is used for developing desktop as well as mobile phone's
operating system.
8. It is used for compiler production.
9. It is widely used in IOT applications.

Why learn 'C'?

As we studied earlier, 'C' is a base language for many programming languages.


So, learning 'C' as the main language will play an important role while studying
other programming languages. It shares the same concepts such as data types,
operators, control statements and many more. 'C' can be used widely in various
applications. It is a simple language and provides faster execution. There are
many jobs available for a 'C' developer in the current market.

Some Main Features of C Programming Language

1) 'C' is a structured programming language in which program is divided into


various modules. Each module can be written separately and together it
forms a single 'C' program. This structure makes it easy for testing,
maintaining and debugging processes.
2) 'C' contains 32 keywords, various data types and a set of powerful built-in
functions that make programming very efficient.
3) Another feature of 'C' programming is that it can extend itself. A 'C'
program contains various functions which are part of a library. We can add
our features and functions to the library. We can access and use these
functions anytime we want in our program. This feature makes it simple
while working with complex programming.
4) Various compilers are available in the market that can be used for
executing programs written in this language.
5) It is a highly portable language which means programs written in 'C'
language can run on other machines. This feature is essential if we wish to
use or execute the code on another computer.

How 'C' Works?

C is a compiled language. A compiler is a special tool that compiles the program


and converts it into the object file which is machine readable. After the
compilation process, the linker will combine different object files and creates a
single executable file to run the program. The following diagram shows the
execution of a 'C' program

4
BCCA Sem-I Programming in C 2020-21

Nowadays, various compilers are available online, and you can use any of those
compilers. The functionality will never differ and most of the compilers will
provide the features required to execute both 'C' and 'C++' programs.

Following is the list of popular compilers available online:


• Clang compiler
• MinGW compiler (Minimalist GNU for Windows)
• Portable 'C' compiler
• Turbo C

Summary

• 'C' was developed by Dennis Ritchie in 1972.


• It is a robust language.
• It is a low programming level language close to machine language
• It is widely used in the software development field.
• It is a procedure and structure-oriented language.
• It has the full support of various operating systems and hardware
platforms.
• Many compilers are available for executing programs written in 'C'.
• A compiler compiles the source file and generates an object file.
• A linker links all the object files together and creates one executable file.
• It is highly portable.

You might also like