Preprocessor Flashcards

1
Q

What happens when we compile a piece of C code?

A

A temp file is generated, this is to perform textual transformations on the code.

This file is then used to create the executable program.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the purpose of the temp file, when compiling C programs?

A

It includes headers to access code defined in other source files

It expands macros

Conditionally enable/disable bits of code

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What should header files contain?

A

Declarations ONLY

NO Definitions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are Macros?

A

These are Textual Substitutions

They are useful for defining compile time constants

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How would I compile a program consisting of multiple source files?

A

For each source (.c) file, create a header file that exposes the interface of the module

Create an object file for each source file

Link the object files to create the executable

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What key word can I use to make sure a function/variable is only used in the file it is declared in?

A

The static keyword

How well did you know this?
1
Not at all
2
3
4
5
Perfectly