Created
June 6, 2019 01:19
-
-
Save conleec/6467eff72621ef6994013660a3f7da0e to your computer and use it in GitHub Desktop.
C++ Misc Notes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Arrays |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ALL elements of an array can be initialized at once like so
There is NO BOUNDS CHECKING in C++ arrays!!!
If you name an array but don't indicate how many elements, C++ will automatically determine based on initilization
Multi-dimensional arrays are organized by Rows and Columns
VECTORS
To declare vector, you must:
Vectors are OBJECTS and have methonds
You can do things like:
vector <double> hi_temps (365, 80.0) // will create 365 elements, ALL initialized to 80.0vectors are always initialized by default
vectors can be accessed with [] sub selector (which offers NO bounds checking
vectors can also be accessed with the .at() method like so:
Static cast to convert types
uses syntax: static_cast(int variable here)
for instance: