Professional Documents
Culture Documents
Overview of C LanguageSTN
Overview of C LanguageSTN
Overview of C LanguageSTN
History of C language
C language has evolved from three different structured language ALGOL, BCPL and B Language. It
uses many concepts from these languages and introduced many new concepts such as data types,
struct, pointer. In 1988, the language was formalised by American National Standard
Institute(ANSI). In 1990, a version of C language was approved by the International Standard
Organisation(ISO) and that version of C is also referred to as C89.
Features of C language
It is a robust language with rich set of built-in functions and operators that can be used to
write any complex program.
The C compiler combines the capabilities of an assembly language with features of a highlevel language.
Programs Written in C are efficient and fast. This is due to its variety of data type and
powerful operators.
C is highly portable this means that programs once written can be run on another machines
with little or no modification.
A C program is basically a collection of functions that are supported by C library. We can also
create our own function and add it to C library.
C language is the most widely used language in operating systems and embedded system
development today.
Pre-processor
Header file
Function
Variables
expression
Comment
Pre-processor
#include, the first word of any C program. It is also known as pre-processor. The main work of preprocessor is to initialize the environment of program, i.e to link the program with the header
file <stdio.h>.
Header file
Header file is a collection of built-in functions that help us in our program. Header files contain
definitions of functions and variables which can be incorporated into any C program by preprocessor #include statement. Standard header files are provided with each compiler, and cover a
range of areas like string handling, mathematical functions, data conversion, printing and reading of
variables.
To use any of the standard functions, the appropriate header file must be included. This is done at
the beginning of the C source file.
For example, to use the printf() function in a program, the line #include <stdio.h> is responsible.
main() function
main() function is a function that must be used in every C program. A function is a sequence of
statement required to perform a specific task. main() function starts the execution of C program. In
the above example,int in front of main() function is the return type of main() function. we will discuss
about it in detail later. The curly braces { } just after the main() function encloses the body
of main() function.
Step 1 : Open turbo C IDE(Integrated Development Environment), click on File and then click on
New
Step 5 : Output
C programming language provides many of the built-in functions to read given input and write data
on screen, printer or in any file.
void main( )
{
int c;
printf("Enter a character");
c=getchar();
putchar(c);
getch();
}
When you will compile the above code,it will ask you to enter a value. When you will enter the value,
it will display the value you have entered.
The main difference between these two functions is that scanf() stops reading characters when it
encounters a space, but gets() reads space as character too.
If you enter name as Study Tonight using scanf() it will only read and store Study and will leave the
part after space. But gets() function will read it complete.