Skip to main content

What are the purposes of #define and #include directive in C language ?


Answer:

#define:
A #define instruction defines value to a symbolic constant for use in the program. #define statement is a prepocessor compiler directive which define a symbolic constant.


When the same value means different things in different places. We need define a symbolic constant. Which has fixed value. This symbolic constant defined by #define prepocessor directive.

Example:
            #define P1 3.14


#include:
C program are divided into modules or functions. Some functions are written by users and many others are stored in the C library. Library function has header files. If we want to access the functions stored in the library, it is necessary to tell the compiler about the files to be accessed. This is achieved by using the preprocessor directive.
#include as follows
#include<filename>

filename is the name of the library file that contains the required function definition preprocessor directives are placed at the beginning of a program.

Popular posts from this blog

Draw the basic organization of computer

Answer:                 The basic organization of computer__ Input Unit: ·          It accepts (or reads) instructions and data from outside. ·          It converts these instructions and data in computer acceptable form ·          It supplies the converted instructions and data to the computer system for further processing. Central Processing Unit (CPU): Control Unit: Control unit of a computer system manages and coordinates the operations of all other components of the computer system. Arithmetic Logic Unit(ALU): Arithmetic logic unit of a computer system is the place, where the actual executions of instruction, takes place during processing operation. Storage Unit: Primary Memory: It is volatile ( loses data on power ...

Describe the four basic data types. How could we extend the range of values they represent?

Answer: The basic four data types are: Data Type Integer Type Character Type Floating Point Type Void Type signed int short int long int unsigned unsigned int unsigned short int unsigned long int char signed char unsigned char float double long double