Answers 831
F
Answers for Day 2
Quiz
- A block.
- The main()function.
- You use program comments to make notations about the program’s structure and
operation. Any text between /and/is a program comment and is ignored by the
compiler. Additionally, you can use single line comments. Any text on the same
line following two forward slashes (//) is considered a comment. - A function is an independent section of program code that performs a certain task
and has been assigned a name. By using a function’s name, a program can execute
the code in the function. - A user-defined function is created by the programmer. A library function is sup-
plied with the C compiler. - An #includedirective instructs the compiler to add the code from another file into
your source code during the compilation process. - Comments shouldn’t be nested. Although some compilers let you to do this, others
don’t. To keep your code portable, you shouldn’t nest comments. - Yes. Comments can be as long as needed. A comment can start with /and won’t
end until a /is encountered. - An include file is also known as a header file.
- An include file is a separate disk file that contains information needed by the com-
piler to use various functions.
Exercises
- Remember, only the main()function is required in C programs. The following is
the smallest possible program, but it doesn’t do anything:
void main(void)
{
}
This also could be written
void main(void){} - a. Statements are on lines 8, 9, 10, 12, 20, and 21.
b. The only variable definition is on line 18.
c. The only function prototype (for display_line()) is on line 4.
49 448201x-APP F 8/13/02 11:22 AM Page 831