Just a random sort of notes as I encounter things in C++

Command Line Arguments

https://www.geeksforgeeks.org/command-line-arguments-in-c-cpp/

Command line arguments: values given after the name of the program in the command-line shell of OS. Handled by main

argc (argument count): number of command-line arguments

  • Non- negative

argv (argument vector): array of character pointers listing all the arguments

  • argv[0] name of the program -argv[1] points to the first command line argument

Compiling with g++

https://natekohl.net/ut/cs105/notes/basics.html (bc idk where my class notes are) g++ -Wall -Werror -o my_program my_program.cc Then execute with: ./my_program

  • -Wall issue warnings about anything the compiler finds suspicious
  • -Werror Treat any warnings it encounters as errors (won’t compile)

Headers vs Implementation files

Split class definitions into header (.h) and implementation (.cc) files

  • To compile, use a Makefile so it’s less complicated

User defined types

https://natekohl.net/ut/cs105/notes/custom_types.html

  • Enumerated
  • Typedef
  • Struct
  • Class

Hi

italics