Lesson 1 Flashcards
Variables, Scope, Functions, Header Files, Conditions and Branches, Logical Expressions, Ternary Operators, Loops and Control Flow, References and Pointers, Dynamic Memory Allocation,Smart Pointers, Classes and Structs, Inheritance, Class Member Visibility, Static in Classes, Mutable, Constructors, Destructors (92 cards)
include
Pre-processor Directive. Starts with #.
int main() { }
A special function that runs your main program.
I.D.E.
Integrated Development Environment
system(“PAUSE”);
This is a function provided by iostream that is often used to keep your program open until there is an input.
Variable
A handle to memory somewhere.
Must have a data type when initialized.
Declaration
Providing something with basic attributes.
It’s type and it’s name.
Definition
A Declaration and an Assignment
Assignment
Setting a value. RHS
Signature
Data type, Name, arguments, argument types, const, static, etc…
char
1 byte - -127 to 127
int
4 bytes - -2b to 2b
unsigned
Same amount of memory but only positive and 0
double
large number with a decimal
bool
true or false
float
number with a decimal
Scope
Lifetime of an object that dictates visibility most often represented with curly brackets.
Region of a program where the binding is valid.
Functions
Names code that will be repeated
Syntax Example:
void add(int arg_1, int arg_2) { }
When do you make a Function
When you find yourself copying code.
Header Files
Files meant to be #included at compile time.
pragma once
Windows specific function that Will check to make sure header files are not duplicated at compile time.
Reest
accelerated garbage
Conditions
Writing code that only runs if specific prerequisites are met. Syntax Example: if(x > 5) { ...run this code... } else { ..do this..};
Ternary Operators
One line conditional assignments
Syntax Example:
int x = (y < 2 && y >= 17 ? 5 : 1);
–if y is less than 2 AND y is greater than or equal to 17 return 5. If not return 1.–
Iterator/Iteration
Processing through a data container often to allow you to manipulate the data at every index.