What Is C Programming Langauge?

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

What is C Programming Langauge?

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


simple, and flexible to use. It is a structured programming language that
is machine-independent and extensively used to write various
applications, Operating Systems like Windows, and many other complex
programs like Oracle database, Git, Python interpreter, and more.
It is said that ‘C’ is a god’s programming language. 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.
‘C’ is a powerful programming language which is strongly associated
with the UNIX operating system. Even most of the UNIX operating
system is coded in ‘C’. Initially ‘C’ programming was limited to the
UNIX operating system, but as it started spreading around the world, it
became commercial, and many compilers were released for cross-
platform systems. Today ‘C’ runs under a variety of operating systems
and hardware platforms. As it started evolving many different versions of
the language were released. At times it became difficult for the
developers to keep up with the latest version as the systems were running
under the older versions. To assure that ‘C’ language will remain
standard, American National Standards Institute (ANSI) defined a
commercial standard for ‘C’ language in 1989. Later, it was approved by
the International Standards Organization (ISO) in 1990. ‘C’ programming
language is also called as ‘ANSI C’.

Number Name language Year of Developer


Development
1 ALGOL 1960 International
Group
2 BCPL 1967 Martin
Richards
3 B 1970 Ken Thompson
4 C 1972 Dennis Ritchie
5 K&R 1978 Kernighan and
Ritchie
6 ANSI C 1989 ANSI
Committee
7 ANSI/ISO C 1990 ISO
Committee
8 C99 1999 Standardization
Committee

Languages such as C++/Java are developed from ‘C’. These languages


are widely used in various technologies. Thus, ‘C’ forms a base for many
other languages that are currently in use.
C Basic Commands
Following are the basic commands in C programming language:

C Basic commands Explanation


#include <stdio.h> This command includes standard input
output header file(stdio.h) from the C library
before compiling a C program
Int main() It is the main function from where C
program execution begins.
{ Indicates the beginning of the main
function.
/*_some_comments_*/ Whatever written inside this command “/*
*/” inside a C program, it will not be
considered for compilation and execution.
Printf(“Hello_World! This command prints the output on the
“); screen.
Getch(); This command is used for any character
input from keyboard.
Return 0; This command is used to terminate a C
program (main function) and it returns 0.
} It is used to indicate the end of the main
function.

C Basic Name What it does (Explanation)


Commands
#include Preprocessor Used to include header files.
directive
<stdio.h> header file The stdio.h header defines three
variable types, several macros, and a
variety of input and output functions.
Main() main function The execution of code begins from
main function.
{ opening curly It indicates the start of a function.
brace
Printf() printing function Used to display output on the screen.
; semicolon Marks the end of the statement.
Return 0; return 0 This command shows the exit status of
a function.
} closing curly It indicates the end of a function.
brace
Where is C used? Key Applications
1. ‘C’ language is widely used in embedded systems.
2. Its used for developing system applications.
3. Its widely used for developing desktop applications.
4. Mostthe 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’.
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 Language?

‘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.
‘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.
‘C’ contains 32 keywords, various data types and a set of powerful built-
in functions that make programming very efficient.
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.
Various compilers are available in the market that can be used for
executing programs written in this language.
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 Programming Language 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.
Introduction to C Programming Language:

The history of C-language is interesting to know. The C-language is a


general-purpose and procedural-oriented programming language. It is a
structured and machine-independent programming language. It was
developed by Dennis Ritchie in 1972 at the AT&T Bell Laboratories. It
was developed along with the UNIX operating system, and is strongly
linked with UNIX operating system. History of C language revolves
around development as a system implementation language to write an
operating system. In terms of the history of C language, its main features
include low-level memory access as well as high-level memory access (so
it is a middle-level programming language), a handy set of keywords, and
a neat and clean style, these features make C programming language
suitable for system programming. C supports a wide variety of built-in
functions, standard libraries and header files. It follows a top-down
approach. Many languages have derived syntax directly or indirectly from
the C programming language. For example, C++ is closely a superset of
the C language. Also, C programming language is very popular for
system-level apps.

Nu Name language Year of Developer


Development
1 ALGOL 1960 International Group
2 BCPL 1967 Martin Richards
3 B 1970 Ken Thompson
4 C 1972 Dennis Ritchie
5 K&R 1978 Kernighan and Ritchie
6 ANSI C 1989 ANSI Committee
7 ANSI/ISO C 1990 ISO Committee
8 C99 1999 Standardization Committee
Early Implementations and Language Standard:
As discussed, in the history of C language, the development of C was
intended to serve as the foundation for the creation of UNIX. By early
1973, the rudiments of ultramodern C had been completed, according to
the Bell Labs report. The language and compiler were both powerful
enough to rewrite the UNIX kernel in C for the PDP-11. Brian Kernighan
and Dennis Ritchie published The C Programming Language in 1978,
which served as a reference for the language until a formal standard was
established in the history of C language. Between 1973 and 1980, the
language evolved slightly: unsigned, long, union, and enumeration types
were added to the type structure, and structures became practically first-
class objects (lacking only a notation for literals). Its environment, as well
as the technology that accompanied it, saw significant changes. In the
summer of 1983, American National Standard Institute (ANSI) formed
the X3J11 committee under the guidance of CBEMA with the purpose of
establishing a C standard. At the end of 1989, X3J11 published its report
[ANSI 89], which was later recognised by ISO as ISO/IEC 9899-1990.

The Problems of B Programming Language:


The B programming language has a different importance in the history of
C language. As its shortcomings made C a more robust language. The
BCPL and B languages were employed on word-addressed machines, and
the sole data type in these languages, the 'cell,' was easily equated with
the hardware machine word. The introduction of the PDP-11 uncovered
various flaws in B's semantic model. First, its character-handling
techniques, which were inherited from BCPL with few changes, were
cumbersome. Second, by specifying special operators, floating-point
operations were introduced to BCPL in Multics and GCOS compilers, but
the process was only conceivable because a single word on the relevant
machines was large enough to represent a floating-point integer; this was
not the case on the 16-bit PDP-11. Finally, the B and BCPL models
implied overhead when dealing with pointers: the language rules caused
pointers to be represented as word indices by defining a pointer as an
index in an array of words. A run-time scale conversion from the pointer
to the byte address anticipated by the hardware was generated for each
pointer reference.
Standardization of C:

In 1983, ANSI formed the X3J11 committee to standardise the C


programming language. The Accredited Standards Committee X3 (ASC
X3), Information Technology, was in charge of this endeavour, which led
in ANSI X3.159-1989: Programming Language C being ratified on
December 14, 1989 and published in the spring of 1990. With some new
additions, this original standard unified existing practises. The standard
stated in the ANSI X3.159-1989 document was known as ANSI C at the
time in the history of C language, however it was quickly superseded
when ISO/IEC 9899:1990 was established as an international standard,
thanks to the efforts of ISO/IEC JTC 1. While this is where the name ISO
C came from, the national and international standards are now known as
C89 and C90, respectively.There have been several updates and
corrigenda produced in the years since the ISO/IEC 9899 international
standard was established. The current C programming language is defined
by ISO/IEC 9899:2018 – Information technology – Programming
languages – C, the fourth edition of the standard. C11 is the informal term
given to the C language established by the 2011 edition of the standard.
While neither this, nor the titles ANSI C and ISO C are ever expressly
referenced in the standard text, their occasional usage underscores the
significance of the hard work carried out by the standards community
over the previous thirty years in unifying this programming language.

How does C Programming Language Work?

Execution of the C program involves 5 steps. These are:


1. Creating the Program
2. Preprocessing
3. Compiling the Program
4. Linkingogram with functions from the C library
5. Executing the Program
1. Creating the Program: Firstly, we need to create a C program.
For that, we will open a text editor and write our C program into it.
Then save the file with .c extension. For example: hello.c The
program written into the file is known as the source code, and it
serves the original form of the C program.
2. Preprocessing: Preprocessing is the stage where source code is
passed for the first time. This stage consists of the following steps:
- Expansion of Macros and Comment Removal
- Expansion of the included files
- Conditional compilation The preprocessed output of hello.c
is stored in the file hello.i.
3. Compiling the Program: Once our source code is preprocessed in
the file hello.i. Now our file is ready for compilation, which after
compilation produces an intermediate compiled output file hello.s,
which is in assembly level instructions. During the compilation
process, the compiler checks for all the compilation errors. If the
online C compiler gives no error, then the hello.s is taken as input
and turned into hello.o by the assembler in the next phase. This file
contains machine-level instructions. At this phase, only existing
code is converted into machine language, and the function calls are
not resolved. Since the object file is not executable, the process is
transferred to the linker, which ultimately produces a .exe file.
4. Linking the Program with functions from the C library: This is
the final phase, in which all of the function calls are linked to their
definitions. Linker knows where all these functions are
implemented. The linker performs additional work and adds more
code to our programme that is required when it starts and stops.
Setting up the environment, for example, requires a code, as does
sending command-line inputs. The linker connects the object code
of our programme file to the C library functions, resulting in an.exe
file, hello.exe, which is an executable file, will be created here.
5. Executing the Program: The execution of a program is a very
simple task. After giving the command to execute a particular
program. The loader will load the executable object code into the
RAM and execute the instructions.
C Basic Commands:

Some basic commands are required to write a C programme. But, before


we get into the basic C commands, let's have a look at a simple C
program.
#include <stdio.h<
Int main() {
Printf("Welcome to the Scaler Topics");
Return 0;
}

Output:
Welcome to the Scaler Topics

Below are a few basic commands of C.

You might also like