1. What is include directive in C?

The include directive is used to include files like as we include header files in the beginning of the program using #include directive like
► #include<stdio.h>
► #include<conio.h></conio.h></stdio.h>

2. What is define directive?

It is used to assign names to different constants or statements which are to be used repeatedly in a program. These defined values or statement can be used by main or in the user defined functions as well.

3. What are # Preprocessor operator in C?

# is called stringize opertor and turns the argument it precede into a quoted string. Use of # is shown in the C Source code given below and should be properly studied.

4. Can a file other than a .h file be included with #include?

The preprocessor will include whatever file you specify in your #include statement. Therefore, if you have the line
#include <macros.inc>
in your program, the file macros.inc will be included in your precompiled program. It is, however, unusual programming practice to put any file that does not have a .h or .hpp extension in an #include statement. You should always put a .h extension on any of your C files you are going to include. This method makes it easier for you and others to identify which files are being used for preprocessing purposes.</macros.inc>

5. What are the advantages of using macro?

In modular programming, using functions is advisable when a certain code is repeated several times in a program. However, everytime a function is called the control gets transferred to that function and then back to the calling function. This consumes a lot of execution time. One way to save this time is by using macros. Macros substitute a function call by the definition of that function. This saves execution time to a great extent.

6. If you know then define #pragma?

The #pragma Directives are used to turn ON or OFF certain features. They vary from compiler to compiler.

7. What is a macro in C Preprocessor?

A macro is a preprocessor directive that provides a mechanism for token replacement in your source code. Macros are created by using the #define statement. Here is an example of a macro:
#define VERSION_STAMP "1.02"

8. What is typedf?

The typedef clause can be used in a similar manner.
typedef long int int32; /* 32 bit signed integer */
The typedef is preferred over the #define because is better integrated into the C language, and it can create more kinds of variable types than a mere define.

9. What is the mean of function?

Functions allow for modular programming. You must remember that all parameters passed into function in C are passed by value!

10. What is #define?

The #define directive can be used to define types, such as:
#define INT32 long int /* 32 bit signed integer type */

Download Interview PDF