Inroduction
c is a procedural programming language.it was developed by Dennis Ritchie between 1963 and
1973.
It was mainly developed as a system programming language to write operating system.
The feature of C language:
Low-access to memory.
Simple Set of keyword.
clean style
The C program is the human-readable form, while the executable that comes out of the compiler is the machine-readable and executable form.
Structure Of C program:
1.Header File
2.Main()
3.Variable Declaration
4.Body
5.Return
1]Header File:
The first and foremost component is the inclusion of the Header files in a C program.
A header file is a file with extension .h which contains C function declarations and macro definitions.
Following are some header files of c language.
stddef.h = Defines different types of declartion and macro.
stdiint.h = Define exact width of integer value.
stdio.h = Defines input and output functions.
stdlib.h = Defines numeric conersion to any other datatype.
string.h = Defines the string functions.
math.h = Defines the math functions.
Syntax of the header file:
#include<(header_file_name).h>
2] Main Method Declaration:
After the declaration of headerfile main() function shoud be declared.
Syntax Of the Main function:
void main()
{
}
3] Variable Declaration:
In c program you shoud not use any variables without declared them.
The variables are declared before any of the function operation.
Syntax Of the variable Declaration:
int a;
where int is a datatype and [a] is name of variable.
Note: Variables are always declared with any of the data type. The datatypes are also available in c which we are discussed letter.
4]Body :
This part is defines the operation performd on the function. The operation can be anything like addition,searching,printing,sorting,etc.
Syntax:
void main()
{
int a;
printf("%d",a);
}
5]Return Statement:
The return statement refers to the returning of the values from a function. This return statement and return value depend upon the return-type of the function.
For example, if the return type is void, then there will be no return statement. In any other case, there will be a return statement and the return value will be of the type of the specified return-type.
EmoticonEmoticon