It Stand for Computer Language. It is a powerful system
programming language,it is introduced by DennisRitchie between
1969 and 1973 at AT&T Bell Laboratory.It was written as a part
of the UNIX operating system.
It has the advance version of B Language, The advance features of C
language are declaring variables having specific datatypes.
In B language this technique is not present due to this it become
the advance language of his time. Several instructions are written
to perform one task is called the computer language.
These instructions are written according to some specific rules.
Structure of C programs:
The format in which a program is written is called the structure
of the program. The structure of a C program consist of three parts.
1: The preprocessor Directives.
2: The main() functions.
3: The C statements.
A program example is given below; the first statement is called the
preprocessor directives which has been written to include the stdio.h and
the conio.h header files. The second statement indicates the main function.
The third statement indicate the C statements with in the main functions inside
the curly braces.
#include<stdio.h>
#include<conio.h>
void main()
{
printf("This is my First C program");
getch();
}
Structure of C programs:
The format in which a program is written is called the structureof the program. The structure of a C program consist of three parts.
1: The Preprocessor Directives.
2: The main() functions.
3: The C statements.
A program example is given below; the first statement is called the
preprocessor directives which has been written to include the stdio.h and
the conio.h header files. When the program is executed, the control goes directly to the main() function.
The second statement indicates the main function.
The third statement indicate the C statements with in the main functions inside
the curly braces. Each statements ends with a semicolon(;). These statements are normally written in lower case letters but, in some cases, these can also be written in uppercase.
#include<stdio.h>
#include<conio.h>
void main()
{
printf("My Name Is Programmer....!!!");
getch();
}
The instructions that are given to the compiler before the beginning of the
actual program are called Preprocessor Directives. These are also known as Compiler Directives. These are written at the beginning of the source code.
These preprocessor directives start with a number sign (#) and the keyword "include" or "define". They are the instructions or directives that tell the compiler to take action(s) before compiling the source code. The program that handles the preprocessor directives is called the preprocessor because it does some processing before the compilation process starts.
For example, preprocessor directives are used to include header files in the program. The preprocessor includes the specified header file into the source code before compiling.
i.e. #include<stdio.h>
or
#define<conio.h>
to use variable, structure or class definitions
available in a library or other source files.
It usually contains the declaration of frequently
used library functions, global variables defined
in other source files, frequently used
macro definitions, and standard structures
(or in C++, classes).
These are part of the C compiler and contain definitions
of standard library functions. These are several header files.
Each header file contains definitions of one type of functions
only; For example, the math.h header file contains definitions
of mathematical functions available in C language.
Each header file has an extension .h. The preprocessor
directive "include" is used to add a header file into the program.
The name of the file is written in angle brackets (<>) after
"#include" directive. The syntax to include a header file is:
#include<name of the header file>
We can also used the keyword "define" and the double quotes (" ")
instead of the angle brackets. i.e.
#define" name of the header file"
If we can't use the conio.h header file then the getch()
function didn't work the program will executed and terminated
but can't show you the output. It contains all the functions of
getch() and many others functions. We use string.h header file to
write those programs which used the string data and it provide
all the features to it i.e.
#include<string.h>
Header Files:
A header file simply contains declarations neededto use variable, structure or class definitions
available in a library or other source files.
It usually contains the declaration of frequently
used library functions, global variables defined
in other source files, frequently used
macro definitions, and standard structures
(or in C++, classes).
These are part of the C compiler and contain definitions
of standard library functions. These are several header files.
Each header file contains definitions of one type of functions
only; For example, the math.h header file contains definitions
of mathematical functions available in C language.
Each header file has an extension .h. The preprocessor
directive "include" is used to add a header file into the program.
The name of the file is written in angle brackets (<>) after
"#include" directive. The syntax to include a header file is:
#include<name of the header file>
We can also used the keyword "define" and the double quotes (" ")
instead of the angle brackets. i.e.
#define" name of the header file"
If we can't use the conio.h header file then the getch()
function didn't work the program will executed and terminated
but can't show you the output. It contains all the functions of
getch() and many others functions. We use string.h header file to
write those programs which used the string data and it provide
all the features to it i.e.
#include<string.h>
No comments:
Post a Comment