Structure Of C Language Program Btech BCA Notes
Before begin with topic I will share some important term and sequence of coding in c programming language. Without them code of C is useless and nothing without them. So, they are stdio.h and conio.h header files.
What is Stdio.h Header file In C Programming?
Stdio.h means Standard input output, which manages the fundamental operations required to run a program. Example is creation of variables assigning them memory etc.
What is conio.h Header file In C Programming?
Conio.h means console input output, which handles the entire input output operation during the course of execution of the program.
you may also like our previous post, first post of C language Beginner our view on C programming Language also read it.
What is the Structure of C language program?
Generally there are five structure of c language program. We use them in every program, Without the structure of program there is nothing because structure give a way of write a program how to write and where we write. It provide kind of path to write a good and running program without any error. So, there structure of C language program are:-
1). Documentation Section
2). Pre-processor Directive Section
3). Global Declaration Section
4). Main Section
5). Sub-program Section
1). Documentation Section In C Language
The first section in a structure of a C-language program is documentation section or commenting Section. Where we specific/provide information about the source code. This section is an optional section makes a program more efficient and scalable.
To provide information, we can either use single line comment (//) or Multiline comment (/* ……. /). Simply we can say here in documentation section we can tell some one about our program via creating title in form of commenting.
2). Pre-processor Directive Section In C Language
Pre-processor directive section is a mandatory Section/Compulsory Section in a structure of C-Language program. In this section we specify the name of header files which are needed to run these source code. Header files are included using a pre-processor directive ( #include ).
Syntax:- #include<name of header file.h>
To include a user defined header file, we use the following syntax.
In this Section, we can also define a macro. Macro is used to create constant or a block of code similar to a function.
Syntax:- #define MACRO NAME value
3). Global Declaration Section In C Language
Global declaration Section is an optional section in which variables with global effect/scope are created. Variables created in this section can be used through out the program or through out the project. Variables created in this section remains in the memory through out the lifetime of the program.
Data type variable name; ( data types:- int, char, float, long etc.)
4). Main Section In C Language
Main Section is the most important part of any C Language program. The code related to the problem to be solved is specified inside main section/function. The execution of the program starts from main section.
Void main()
{
//code to be executed
}
Main is function from where execution starts. Main is called automatically. This section is compulsory in C program.
5). Sub-program Section In C Language
In C Language program, we can create a block of code which can be executed any number of times as and when required. Such a block of code is called a Sub-program or a function. A Sub-program helps in achieving code reusability.
Syntax:-
returntype name of the function()
{
code
}
Some important lines to Remembering in C Programming Turbo c/c++
* Compiler:- Whenever we compile a code the code is checked by the compiler, If their is no error, Then the code is converted into the format which is understand by the machine. This process is called Compilation.
* Write the code and save in turbo = .c
* Compile the code in turbo = Alt+F9
* Run the code in turbo = Ctrl+F9
* copy code in turbo = Cltr+Insert
* Paste code in turbo = Shift+Insert
* Cut lines = shift+Delete
* Go back during run a code = tc.exe
* Close the application = Alt+X
We will going on series of C Programming language of all topics. So, you can follow us for more updates.
Comments
Post a Comment