More about C Language:
What is mean by a Program? In general a program is a set of statements written to do a particular task. These statements will execute one after another sequentially.
But a C program is made up of number of functions. Most of the statement in “C” program is a function. In the below given program “main” is a function which is mandatory (compulsory) for every C program.
Why “main” function is need? A C Program starts its execution from main function only. Because, when you try to execute a C program, the Operating System will starts that program execution from main function only. In general if a program is not having main function, we can’t execute that program.
Why Operating system starts execution from main() function?
The main function will call other functions which have been defined in that program or in any other Preprocessor directives
Preprocessor Directive: It is nothing but a file; it contains definitions for various functions. These functions are called built-in function.
Built-in functions are the functions which are built or tied or combined along with the C Language.
# include – It is used to include Preprocessor directive into your source program. When we use this, it includes the specified preprocessor directive(file) to your source code by internally invoking the Linker by Compiler.
What is the need of including the preprocessor directive? The Computer doesn’t know what it has to do. For example when you are using printf() function, the computer doesn’t know what to do and how to do. So, preprocessor directives contains the definition for printf() function. If you didn’t include this preprocessor directive into your program, you have to define it in your source program.
Linker & Compiler are the piece of software programs.
Compiler: The compiler is a piece of software program, it will convert source code into object code or in other words it converts your high level language code into machine code.
Linker: The Linker is a piece of software program; it links the preprocessor directive to your source code when you compile your source program.
In the below given program printf() is a function which is used to print / display text or data on the monitor. It is an output function (it is built-in function).