Welcome back! In my first post, I tell you that C++ is a advanced version of C. It means that you must learn C language before starting C++.
First of all, We should know about a C program structure that is shown below:
A program is made up of different parts, which are as follow:
#include<conio.h>
#include<math.h>
#include<graphics.h>......etc.
First of all, We should know about a C program structure that is shown below:
A program is made up of different parts, which are as follow:
- Documentation section:- Under this section, Programmer writes information related to his program such as- the purpose of writing programs, date of creation and programmer's name etc. To write an information such as /*...............*/
- Link section:- Under this section, the Header files(Input/output library) used in the program are added. Header files(I/O library) are of the following type.
#include<conio.h>
#include<math.h>
#include<graphics.h>......etc.
Note: A library is simply a package of code that someone else has wrriten to make coding easier.
ii) Executable part:- Various actions in the program are displayed in this section.
- Defination section:- Constant value is defaced under this section such as:
- Global variable declration section:- Global variable is a variable that can be used in any part of the program. All global variables in the program are declared under this section.
- Main Function:- This is the main part of the program and the implementation of the program starts with this, it has two parts:
ii) Executable part:- Various actions in the program are displayed in this section.
Example:
/* PROGRAM FOR ADD TWO NUMBERS*/
#include<stdio.h>
#include<conio.h>
void main()
{
{
int num1, num2, sum;
clrscr();
printf("Enter the two integer values to be added");
scanf("%d%d", &num1, num2, sum);
sum=num1+num2; printf("Addition of %d and%d is %d\n", num1, num2, sum);
getch();
}
very good
ReplyDeleteThanks..subscribe to our newsletter to get updates and continue reading.
ReplyDeleteThanks..subscribe to our newsletter to get updates and continue reading.
ReplyDeletethe following information is so useful for me.. thanks a lot...
ReplyDelete