Discussion 1: C++ Refresher Flashcards
preprocessor directives
top of file with a #, processed before the compiler, #include, #define, (#ifdef, #ifndef, #endif), #pragma once
include
include replaces the directive with the content of the specified header or file
define (
define replaces all instances of identifier with replacement.
ifdef, ifndef, and #endif
identifiers allows sections to be complied if an identifier is/isnt defined
pragma once
makes source file to be included only once in a single compilation
char
1 byte | primitive type
std::string( char array )
char array
int (How many bytes, range)
4 bytes | -2.147 bil - 2.147 bil
unsigned int (How many bytes, range)
4 bytes | 0 to 4.294 bil
long (how many bytes, range)
8 bytes | -910^18 to 910^18
unsigned long (bytes, range)
8 bytes | 0 to 18*10^18
double (bytes, use case)
8 bytes | used for decimals
float (bytes, use case)
4 bytes | used for decimals
float vs double
float uses 4 bytes , double uses 8 bytes.
Use case: double is more precise
bool
1 byte | True or False