-
Intro to C++ - Types
Friday, March 13, 2020
We’ll be investigating the primitive types C++ has to offer in this post and reference types in the following post. Integers The Integer type store whole numbers and come in four sizes: short int, int, long int, long long int. In addition, each type can be signed (negative whole numbers permitted) or unsigned (only positive numbers). A short is typically 2 bytes in size and an int is 4 bytes. A long is 4 bytes on everything except on 64-bit Linxu/macOS where it is 8 bytes.…more
-
Intro to C++ - Getting Started
Tuesday, March 10, 2020
To begin, we write human-redable C++ code in a source file which is then compiled to produce machine code that our computers can run. Here’s an example of a minimal source file: // main.cpp #include <cstdio> int main() { printf("Hello, World!"); return 0; } The above declares a function called main which serves as an entry point to our program, after all, the program has to stat somewhere. Within our main function we call another function printf which prints the text to the terminal.…more