Data Structures Midterm 1
implemntation
Abstraction is used to implement hidden details
Be able to compile a program modularly as opposed to with a single step.
Be able to compile a program modularly as opposed to with a single step.
Be able to read basic compilation commands and state the result (whether it is a .o or executable).
Object code (contains source code) (within an object file): Output from a compiler intended as input for a linker (for the linker to produce executable code). Executable: A program ready to be run (executed) on a computer
Be able to differentiate when the . operator versus the -> operator should be used.
This is an example from my textbook.*cirPtr.radius = 10 ;^^ This is what would assume to be a pointer to a member of a structure. HOWEVER,The dot operator has higher precedence than the indirection operator, so the indirection operator tries to dereference cirPtr . radius, nor cirPtr.So you need to use parenthesis.(*cirPtr) .radius = 10 ;Since this is considered "awkward" (as the author of my text says) the -> is a visual alternative. This is only used with structures, so no need to even worry about it unit you get there.cirPtr->radius = 10; is the same as the above.Simple answer...... It's a matter of order of operations......
data structure
a way of organizing, storing, and performing operations on data
Header file guards
are preprocessor directives, which cause the compiler to only include the contents of the header file once. #ifndef file #define file #endif //file -Without header guards the file a.h will be included twice, which can cause errors. If the header files had header guards then the file a.h would only be included once
What should be in a hpp file?
function declarations
What should be in a cpp file?
function definitions
abstract data types
is a data type whose creation and update are constrained to specific well-defined operations. A class can be used to implement an ADT.
Abstraction
to have a user interact with an item at a high-level, with lower-level internal details hidden from the user (aka information hiding or encapsulation). Ex: An oven supports an abstraction of a food compartment and a knob to control heat. An oven's user need not interact with internal parts of an oven.
Makefile
to recompile and link a program whenever changes are made to the source or header files. The makefile consists of a set of rules and commands.