InterviewSolution
| 1. |
Define Which Header File To Include At Compile Time? |
|
Answer» YES. This can be DONE by using the #if, #else, and #ENDIF preprocessor directives. For example, certain compilers use different names for header files. One such CASE is between Borland C++, which uses the header file alloc.h, and Microsoft C++, which uses the header file malloc.h. Both of these headers serve the same purpose, and each contains ROUGHLY the same definitions. If, however, you are writing a program that is to support Borland C++ and Microsoft C++, you must define which header to include at compile time. The following example shows how this can be done: #ifdef _ _BORLANDC_ _ #include #else #include #endif.Yes. This can be done by using the #if, #else, and #endif preprocessor directives. For example, certain compilers use different names for header files. One such case is between Borland C++, which uses the header file alloc.h, and Microsoft C++, which uses the header file malloc.h. Both of these headers serve the same purpose, and each contains roughly the same definitions. If, however, you are writing a program that is to support Borland C++ and Microsoft C++, you must define which header to include at compile time. The following example shows how this can be done: |
|