Preprocessor Directives II-253
Explanation: In the above program, PI replaces with 3.14 during the program execution. In the
program, instead of writing the value of PI as 3.14, we define directly the value of PI as 3.14. The term
PI is replaced with 3.14 in the program. PI macro is used for calculating the area of a circle.
4. What is the #include directive? How does it help the programmer?
Ans: The #include directive loads specified file in the current program. The included programmers
file executes along with the current program. The macros and functions of loaded file can be included
in the current program. Both the included file and the current program are complied.
5. What is the syntax of #include directive? Elaborate it with examples.
Ans: Syntax of #include directive is as follows:
(a) #include "filename"
(b) #include <filename>
where # is a symbol used with directives.
(a) The file name is included in the double quotation marks indicating that the search for the file
is made in the current directory and in the standard directories.
For example, #include "stdio.h"
(b) When the filename is enclosed within angle brackets without double quotation marks, the
search for file is made only in the standard directories.
For examples, #include <stdio.h>
6. Write a program on include directive.
printf("\n Enter radius of circle in cms :-");
printf("Area of a Circle = %.2f cm^2",area);
Enter radius of circle in centimetres: 7
Area of a circle =153.86 cm^2
M12_ITL-ESL4791_02_SE_C12.indd 253 12/22/2012 5:05:48 PM