Chapter 1 Flashcards
Important information to know from Chapter 1
What is a compiler?
A compiler is a program that translates source code written in a programming language (like C++) into machine code that can be executed by a computer.
What is the #include directive commonly used for in C++?
This is commonly used to include standard library header files or user-defined header files in your program.
What is the purpose of the compiler?
The purpose of a compiler is to transform human-readable code into a format that a computer can understand and execute.
What is the purpose of the #include directive?
The #include directive in C++ tells the preprocessor to insert the contents of another file into the source code at the point where the directive is found.
What does a .cpp suffix at the end of a file name signify in C++?
A file with a .cpp suffix is a C++ source file. This file contains the source code written in the C++ programming language.
What does the linker do for your program?
After the compiler creates object files from the source code, the linker combines these object files into a single executable program. The linker also resolves any symbolic references to memory locations, such as function calls or variables that are defined in different source files.
What is the difference between a source file and an object file?
A source file (like a .cpp file) contains the source code written by the programmer.
An object file is a file containing object code, including instructions that the computer can understand directly (machine code), but that is not ready to be run as a program.
It’s an intermediate file produced by the compiler after it processes a source file.
What is an executable?
An executable is a file that contains a program - that is, a particular kind of file that is capable of being executed or run as a program in the computer.
In simple terms, it’s the final output of the compilation and linking process that you can run on your computer.
What is a comment?
A comment is a programmer-readable explanation or annotation in the source code. It is completely ignored by compilers and interpreters.
In C++, comments can be single-line, starting with //, or multi-line, enclosed by /* and */.
What are the four parts of a function in C++?
- A return type
- A name
- A parameter list, enclosed in parentheses
- A function body, enclosed in a set of “curly braces”
What is the purpose behind ending he function main
To tell the C++ program where to start executing
What is a function?
A named sequence of instructions for the computer to execute in the order in which they are written
What is an error?
A mistake made in your code resulting in it not working properly
What is the command line?
A text-based editing environment
What is object code?
A machine-readable version of code