If you want to be a good programmer,You need to know the
basic structure of a language (C).
In C basically there are two parts.Like Include Files Part
& Main function () part.
Include files like header files.There are many header files
stored In C language library.such as #include <stdio.h>, #include <math.h>,#include
<conio.h> etc.
Main function usually declare the
variables and call the library functions,user defined functions.Every C program
starts with main ().You can not think C without main ().In C,there can be many
functions along with main ().Every function has specific work.
“Other functions” part is under main () function.Main ()
function call different types of library functions like,
clrscr(),getch(),sqrt(),printf(),scanf(). And also call user defined functions.
Now I am going to describe a program sections.
You can write comments in the document section.To write
single line comment use // and for multiline comment use /*……*/.
You have to link a header file in the link section.Header
files define the library functions and keywords.Header files executes the
program.
Symbolic constants are defined in the definition section.
Global variables are declared in the Global variable
declaration section.Global variables can be used in several function.
Main function is a function where a program call the library
functions and user defined functions.C program starts from compile and executes
main() function.
Main function consist of two parts:
(1)Declaration part:- It declare all variables which are
used in executable part.
(2)Executable part:- Executable part contains with minimum one statement.
There is a Demo program for you:
#include <stdio.h>
int main ()
{
printf("Hello
World.");
return 0;
}
Be continue.......
#include
ReplyDeleteint main ()
{
printf("we are friends");
return 0;
}