Tuesday 26 March 2019

Preprocessor Directive in programing c

Preprocessor Directive:

#include<stdio.h> tells the compiler to include information about the standard
input/output library. It is also used in symbolic constant such as #define PI
3.14(value). The stdio.h (standard input output header file) contains definition
&declaration of system defined function such as printf( ), scanf( ), pow( ) etc.
Generally printf() function used to display and scanf() function used to read value
Global Declaration:
This is the section where variable are declared globally so that it can be access by
all the functions used in the program. And it is generally declared outside the
function :
main()
It is the user defined function and every function has one main() function from
where actually program is started and it is encloses within the pair of curly braces.
The main( ) function can be anywhere in the program but in general practice it is
placed in the first position.
Syntax :
main()
{
……..
……..
……..
}
The main( ) function return value when it declared by data type as
int main( )
{
return 0
}
The main function does not return any value when void (means null/empty) as
void main(void ) or void main()
{
printf (“C language”);
}
Output: C language
The program execution start with opening braces and end with closing brace.
And in between the two braces declaration part as well as executable part is
mentioned. And at the end of each line, the semi-colon is given which indicates
statement termination.

/*First c program with return statement*/
#include <stdio.h>
int main (void)
{
printf ("welcome to c Programming language.\n");
return 0;
}

Output: welcome to c programming language.

0 comments:

Post a Comment