{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

L11multfiles

L11multfiles - Program in Multiple Files ● all C...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Program in Multiple Files ● all C++ statements are divided into executable and non-executable ● executable- some corresponding machine code is generated by the compiler ■ examples: assignment statements, looping/branching constructs, function invocations ● non-executable- no machine code generated ■ examples: function prototypes, global variable and constant declarations, #include directives ● global constant declarations may look like executable - they are not: const double PI=3.14; the compiler substituites 3.14 for ever occurrence of PI in the program (Non) Executable Statements ● #include instructions tell the compiler to include specified file. The files included are called header files and commonly have extensions .h ● two forms: #include <filename>- the file is found in standard system- dependent location #include “filename.h”- the file is located in the same directory as the rest of the code ● the include directives are processed before the rest of the compilation ● header files may also contain include directives ● what to put in include files - non-executable statements ● what not to put in include files - executable statements, function definitions ● purpose of header files - centralize declarations Include Files ● large programs are usually kept in multiple files ● reasons: ■ easy to maintain ■ can be compiled separately ● functions are usually grouped into files by their purpose (functions...
View Full Document

{[ snackBarMessage ]}

Page1 / 11

L11multfiles - Program in Multiple Files ● all C...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon bookmark
Ask a homework question - tutors are online