Vous êtes sur la page 1sur 4

Features of C

a) Middle Level Language : C is thought of as a middle level language because it combines


elements of high-level language with the functionalism of assembly language. C allows
manipulation of bits, bytes and addresses - the basic elements with which the computer functions.
Also, C code is very portable, that is software written on one type of computer can be adapted to
work on another type. Although C has five basic built-in data types, it is not strongly typed
language as compared to high level languages, C permits almost all data type conversions.

It allows direct manipulation of bits, bytes, words, and pointers. Thus, it is ideal for system level-
programming.

b) Structured Language : The term block structured language does not apply strickly to C.
Technically, a block-structured language permits procedures and function to be declared inside
other procedures or functions. C does not allow creation of functions, within functions, and
therefore cannot formally be called a block-structured language. However, it is referred to as a
structured language because it is similar in many ways to other structured languages like ALGOL,
Pascal and the likes.

C allows compartmentalisation of code and data. This is a distinguishing feature of any structured

language. It refers to the ability of a language to section off and hide all information and
instructions necessary to perform a specific task from the rest of the program. Code can be
compartmentalised in C using functions or code blocks. Functions are used to define and code
separately, special tasks required in a program. This allows programs to be modular. Code block
is a logically connected group of program statements that is treated like a unit. A code block is
created by placing a sequence of statements between opening and closing curly braces.

c) Machine Independent (Portability of Code) : The code written in c is machine independent


which means, there is no change in ‘C’ instructions, when you change the Operating System or
Hardware. There is hardly any change required to compile when you move the program from one
environment to another.

Eg. Program written in DOS Operating System can be easily compiled on UNIX operating system
by copying the source code on to the UNIX operating system and compiling it over there.

d) Fast Speed ( Better Performance ) : The execution speed of programs written in C is very
fast since the statements are converted to few machine instructions which directly go into the
processor for implementing the task.

e) Keywords with Libraries : The Original ‘C’ ( developed by Dennis Ritche ) is having only 32
keywords to perform all tasks which sometimes makes programming very tedious. But now we
have ready made libraries of functions which can be used to perform simple tasks very easily
without much of the coding. Library functions like printf() and scanf() can be used for Input and
Output, they belong to stdio (Standard Input Output ) library.
f. Compiler Language : C Language uses COMPILER to translate your instruction code to
machine code. Compiler takes the text source code and coverts to object code and then Linker
( part of compiler only ) converts it to executable code by taking reference of Library.

The various well-known compilers available for C are

o Turbo C
o Borland C
o Microsoft C

Note : Though there is only small difference in all these compilers, Let’s make it
clear that this tutorial will deal with Turbo C 2.0

A simple ‘c’ program

/* my first c program */

main()
{

printf("hello world");

In Turbo C compiler following shortcut keys are used

Keys Operation

F9 Compile Only

Ctrl F9 Compile & run

Alt F5 To see Output Screen

F2 Save the File

Alt X Exit Turbo C

F3 Load File

Alt F3 Pick File from List

Explaination of the program written above :

; as statement terminator : In C ‘;’ is used as statement terminator. That means we can write as
many statements as we want on a single line since statement is not terminated with new line
character.

Case sensitive : C is very sensitive as far as Case is concerned. var & VAR are two different
entities in c. One should remember in what case the variable were declared. For convenience
everything is declared in lower case only.
Starts with main() function

Block of statements ( ‘{‘ for beginning of block & ‘}’ for end of block )

/* */ for writing comments in program.

main()

printf("C was developed");

printf("\nDennis Ritchie");

Escape Sequences

Character Meaning Example Output

\n New line Hello \nWorld Hello

World

\t Tab Hello \tWorld Hello World

\r Return Hello \rMe Mello

\a Alert ( beep sound ) Hello \aworld Hello world

\0 Null Hello \0 World Hello

Vous aimerez peut-être aussi