Submitted by tushar pramanick on Mon, 02/25/2013 - 11:35

Questions and Answers


Q Why do you need to put comments into your programs?
A Comments help us document what a program, or a special portion of a program, does. Especially when a program becomes very complex, we need to write comments to mark different parts in the program.

 

Q Why is the main() function needed in your program?
A The execution of a C program starts and ends with the main() function. Without the main() function, the computer does not know where to start to run a program.

 

Q What does the #include directive do?
A The #include directive is used to include header files that contain the declarations to the functions used in your C program. In other words, the #include directive tells the C preprocessor to look into directories and find the specified header file.

 

Q Why do you need a linker?
A After compiling, some function code may still be missing in the object file of a program. A linker must then be used to link the object file to the C standard library or other user-generated libraries and include the missing function code so that an executable file can be created.

 

 

Related Items

The #define and #undef Directives

The #define and #undef Directives

The #define directive is the most common preprocessor directive, which tells the preprocessor to replace every occurrence of a particular character string (that is, a macro name) with a specified value (that is, a macro body).

The C Preprocessor Versus the Compiler

The C Preprocessor Versus the Compiler

One important thing you need to remember is that the C preprocessor is not part of the C compiler.

What Is the C Preprocessor?

If there is a constant appearing in several places in your program, it's a good idea to associate a symbolic name to the constant, and then use the symbolic name to replace the constant throughout the program. There are two advantages to doing so. First, your program will be more readable.

Exercises : Answer the following Question

To help solidify your understanding of this hour's lesson, you are encouraged to answer the quiz questions and finish the exercises provided in the Workshop before you move to the next lesson.

Question and Answer

    Q Why is random access to a disk file necessary?