\documentclass[10pt,a4paper]{article} % Packages \usepackage{fancyhdr} % For header and footer \usepackage{multicol} % Allows multicols in tables \usepackage{tabularx} % Intelligent column widths \usepackage{tabulary} % Used in header and footer \usepackage{hhline} % Border under tables \usepackage{graphicx} % For images \usepackage{xcolor} % For hex colours %\usepackage[utf8x]{inputenc} % For unicode character support \usepackage[T1]{fontenc} % Without this we get weird character replacements \usepackage{colortbl} % For coloured tables \usepackage{setspace} % For line height \usepackage{lastpage} % Needed for total page number \usepackage{seqsplit} % Splits long words. %\usepackage{opensans} % Can't make this work so far. Shame. Would be lovely. \usepackage[normalem]{ulem} % For underlining links % Most of the following are not required for the majority % of cheat sheets but are needed for some symbol support. \usepackage{amsmath} % Symbols \usepackage{MnSymbol} % Symbols \usepackage{wasysym} % Symbols %\usepackage[english,german,french,spanish,italian]{babel} % Languages % Document Info \author{zreich} \pdfinfo{ /Title (c.pdf) /Creator (Cheatography) /Author (zreich) /Subject (c++ Cheat Sheet) } % Lengths and widths \addtolength{\textwidth}{6cm} \addtolength{\textheight}{-1cm} \addtolength{\hoffset}{-3cm} \addtolength{\voffset}{-2cm} \setlength{\tabcolsep}{0.2cm} % Space between columns \setlength{\headsep}{-12pt} % Reduce space between header and content \setlength{\headheight}{85pt} % If less, LaTeX automatically increases it \renewcommand{\footrulewidth}{0pt} % Remove footer line \renewcommand{\headrulewidth}{0pt} % Remove header line \renewcommand{\seqinsert}{\ifmmode\allowbreak\else\-\fi} % Hyphens in seqsplit % This two commands together give roughly % the right line height in the tables \renewcommand{\arraystretch}{1.3} \onehalfspacing % Commands \newcommand{\SetRowColor}[1]{\noalign{\gdef\RowColorName{#1}}\rowcolor{\RowColorName}} % Shortcut for row colour \newcommand{\mymulticolumn}[3]{\multicolumn{#1}{>{\columncolor{\RowColorName}}#2}{#3}} % For coloured multi-cols \newcolumntype{x}[1]{>{\raggedright}p{#1}} % New column types for ragged-right paragraph columns \newcommand{\tn}{\tabularnewline} % Required as custom column type in use % Font and Colours \definecolor{HeadBackground}{HTML}{333333} \definecolor{FootBackground}{HTML}{666666} \definecolor{TextColor}{HTML}{333333} \definecolor{DarkBackground}{HTML}{A3A3A3} \definecolor{LightBackground}{HTML}{F3F3F3} \renewcommand{\familydefault}{\sfdefault} \color{TextColor} % Header and Footer \pagestyle{fancy} \fancyhead{} % Set header to blank \fancyfoot{} % Set footer to blank \fancyhead[L]{ \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{C} \SetRowColor{DarkBackground} \vspace{-7pt} {\parbox{\dimexpr\textwidth-2\fboxsep\relax}{\noindent \hspace*{-6pt}\includegraphics[width=5.8cm]{/web/www.cheatography.com/public/images/cheatography_logo.pdf}} } \end{tabulary} \columnbreak \begin{tabulary}{11cm}{L} \vspace{-2pt}\large{\bf{\textcolor{DarkBackground}{\textrm{c++ Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{zreich} via \textcolor{DarkBackground}{\uline{cheatography.com/52369/cs/14235/}}} \end{tabulary} \end{multicols}} \fancyfoot[L]{ \footnotesize \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{LL} \SetRowColor{FootBackground} \mymulticolumn{2}{p{5.377cm}}{\bf\textcolor{white}{Cheatographer}} \\ \vspace{-2pt}zreich \\ \uline{cheatography.com/zreich} \\ \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Not Yet Published.\\ Updated 8th January, 2018.\\ Page {\thepage} of \pageref{LastPage}. \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Sponsor}} \\ \SetRowColor{white} \vspace{-5pt} %\includegraphics[width=48px,height=48px]{dave.jpeg} Measure your website readability!\\ www.readability-score.com \end{tabulary} \end{multicols}} \begin{document} \raggedright \raggedcolumns % Set font size to small. Switch to any value % from this page to resize cheat sheet text: % www.emerson.emory.edu/services/latex/latex_169.html \footnotesize % Small font. \begin{multicols*}{3} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{\textless{}fstream\textgreater{}}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{ifstream} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{ofstream} \tn % Row Count 2 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{\textless{}cstring\textgreater{}}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{strcpy(destination, source) incl. sentinel char} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{strcat(destination, source)} \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{strcmp(str1, str2); if = 0 then equal, if \textgreater{}0 then str1 is greater else str1 is smaller} \tn % Row Count 4 (+ 2) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{strlen(char* str) returns int; not include sentinel} \tn % Row Count 6 (+ 2) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{strncpy(dest,src, number of characters)} \tn % Row Count 7 (+ 1) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{strncat(d,s,n); strncmp(d,s,n)} \tn % Row Count 8 (+ 1) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{strchr(char{\emph{ str, char) returns a pointer (char}}) to the first occurence of char in str else returns null} \tn % Row Count 11 (+ 3) % Row 7 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{strstr(str1, str2) returns pointer to first occurence of str2 in str1 (e.g. ptr = strstr(str1, "hello")} \tn % Row Count 14 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{\textless{}cmath\textgreater{}}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{abs(int) returns the absolute of the int} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{pow(base, exponent) returns the power} \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{sqrt(number) returns the square root} \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{ceil(number) rounds up; floor(number) rounds down} \tn % Row Count 4 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{\textless{}cstdlib\textgreater{}}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{atoi(str) converts str to int; atof(str) converts str to double; use with c strings (char *)} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{exit(1)} \tn % Row Count 3 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{x = rand() \% number; srand(time(NULL) requires \textless{}time.h\textgreater{}} \tn % Row Count 5 (+ 2) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{itoa(value, array, base); value = str to be converted; array = c string array; base = 10, 2, 16, etc.} \tn % Row Count 8 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Pointers}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{- Pointer is the memory address of a variable (i.e. int * num\_ptr) \newline % Row Count 2 (+ 2) - Use typedef to declare variable type (i.e. typedef int* num\_ptr -\textgreater{} num\_ptr X;) \newline % Row Count 4 (+ 2) - Create dynamic var: ptr = new type; delete dynamic var: delete ptr \newline % Row Count 6 (+ 2) - Deleting dynamic var does not delete the ptr just what is stored inside it \newline % Row Count 8 (+ 2) - Make sure to assign null to ptr after delete so it is not dangling \newline % Row Count 10 (+ 2) ptr\_a = new (nothrow) int; \newline % Row Count 11 (+ 1) if (ptr\_a == NULL) \{ \newline % Row Count 12 (+ 1) cout \textless{}\textless{} "sorry"; \newline % Row Count 13 (+ 1) exit(1); \} \textless{}- ptr set to null if allocation fails \newline % Row Count 14 (+ 1) - array identifiers are pointers \newline % Row Count 15 (+ 1) int hours{[}5{]}; \newline % Row Count 16 (+ 1) int* ptr; \newline % Row Count 17 (+ 1) ptr = hours; \textless{}- both point to first index \newline % Row Count 18 (+ 1) - hours{[}1{]} is equivalent to *(hours+1) \newline % Row Count 19 (+ 1) - char phrase{[}{]} is equivalent to char* phrase \newline % Row Count 20 (+ 1) int* number\_ptr; \newline % Row Count 21 (+ 1) number\_ptr = new int{[}10{]} \textless{}- dynamic array \newline % Row Count 22 (+ 1) delete {[}{]} number\_ptr;% Row Count 23 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Strings}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{- Sentinel character is '\textbackslash{}0' and marks the end of string \newline % Row Count 2 (+ 2) - char phrase{[}5{]} = \{'A', 'B'\} or char phrase{[}{]} = "Hello" \newline % Row Count 4 (+ 2) - Using \textgreater{}\textgreater{} to input strings is limited because it ends at white space \newline % Row Count 6 (+ 2) - cin.getline(string\_name, 80) is often used instead% Row Count 8 (+ 2) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{\textless{}algorithm\textgreater{}}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{swap(var1, var2) swaps the 2 variables; also works arrays/vector} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{min(val1,val2), max(val1,val2);} \tn % Row Count 3 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{find(begin, end, val); if no found return end} \tn % Row Count 4 (+ 1) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{replace(begin,end,oldval,newval)} \tn % Row Count 5 (+ 1) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{sort(begin, end)} \tn % Row Count 6 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{\textless{}cctype\textgreater{}}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{tolower(char) converts to lowercase; toupper(char) converts to upper case} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{isalpha(char) returns true if char is alphabetic (0 = false)} \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{isalnum(char) returns true if char is decimal, upper/lower} \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{isblank(char), isspace(char) return true if char is either ' ' or \textbackslash{}n} \tn % Row Count 8 (+ 2) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{isupper(char), islower(char), isdigit(char) are all boolean} \tn % Row Count 10 (+ 2) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{ispunct(char) returns true if char is punctuation} \tn % Row Count 11 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{letter to number / number to letter}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{int -\textgreater{} char \newline % Row Count 1 (+ 1) int number = 40; \newline % Row Count 2 (+ 1) char letter = number; \newline % Row Count 3 (+ 1) char -\textgreater{} int \newline % Row Count 4 (+ 1) char letter = 'c'; \newline % Row Count 5 (+ 1) int number = letter; \newline % Row Count 6 (+ 1) notes: \newline % Row Count 7 (+ 1) ASCII for 0 = 48 \newline % Row Count 8 (+ 1) ASCII for space = 32 \newline % Row Count 9 (+ 1) ASCII for A = 65 \newline % Row Count 10 (+ 1) ASCII for a = 97% Row Count 11 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Streams}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{- connect: stream.open("name"); \textless{}- connects to the beginning of the file \newline % Row Count 2 (+ 2) - disconnect: stream.close(); \newline % Row Count 3 (+ 1) stream.open("name") \newline % Row Count 4 (+ 1) if (stream.fail()) \{ \newline % Row Count 5 (+ 1) sorry + exit \} \newline % Row Count 6 (+ 1) - in\_stream.get(ch) -\textgreater{} assigns ch the next char in the file and repositions file \newline % Row Count 8 (+ 2) - out\_stream.put(ch) -\textgreater{} puts ch in next position in file \newline % Row Count 10 (+ 2) - in\_stream.putback(ch) -\textgreater{} puts back in the file but does not alter file \newline % Row Count 12 (+ 2) - char = in\_stream.peek() assigns char the next char in file but does not move it forward \newline % Row Count 14 (+ 2) in\_stream.get(ch) \newline % Row Count 15 (+ 1) while (! in\_stream.eof()) \{ \newline % Row Count 16 (+ 1) cout \textless{}\textless{} ch; \newline % Row Count 17 (+ 1) out\_stream.put(ch); \newline % Row Count 18 (+ 1) in\_stream.get(ch) \} \newline % Row Count 19 (+ 1) - streams must be reference \& arguments in functions only% Row Count 21 (+ 2) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{GDB}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{- 'gdb' to start gdb \newline % Row Count 1 (+ 1) - Start with 'run' or 'r' \newline % Row Count 2 (+ 1) - Set breakpoint with 'break' \newline % Row Count 3 (+ 1) - Print variable\_name, \&variable\_address \newline % Row Count 4 (+ 1) - 'Watch' variable\_name \newline % Row Count 5 (+ 1) - 'C' for continue \newline % Row Count 6 (+ 1) - Execute next line using 'step' or 's' \newline % Row Count 7 (+ 1) - 'Next' or 'n' \newline % Row Count 8 (+ 1) - Pressing enter repeats last command \newline % Row Count 9 (+ 1) - 'q' to quit \newline % Row Count 10 (+ 1) - 'finish' to stop execution of current function% Row Count 11 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Loops}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{- Do \{ ... \} While (bool) \newline % Row Count 1 (+ 1) switch (selector) \{ \newline % Row Count 2 (+ 1) case label1: \newline % Row Count 3 (+ 1) statement; \newline % Row Count 4 (+ 1) break; \newline % Row Count 5 (+ 1) default: \newline % Row Count 6 (+ 1) statment; \newline % Row Count 7 (+ 1) break; \}% Row Count 8 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{\textless{}array\textgreater{}}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{array\_name.begin() / array\_name.end = first and last elements in the array; also .front/.back} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{array\_name.size() = number of elements in the array vs. sizeof(expression/type) = bytes} \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{array\_name.max\_size() returns max number of elements allowed in array} \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{array\_name.empty() returns true if array size is 0 meaning no elements} \tn % Row Count 8 (+ 2) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{array\_name.at(int) = array at position int like array\_name{[}int{]}} \tn % Row Count 10 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{\textless{}string\textgreater{}}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{getline(input\_stream, str, optional\_limit)} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{begin(array); end(array); .begin/.end} \tn % Row Count 2 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Makefiles}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{p{5.377cm}}{\vspace{1px}\centerline{\includegraphics[width=5.1cm]{/web/www.cheatography.com/public/uploads/zreich_1515368181_Screen Shot 2018-01-07 at 11.35.16 PM.png}}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{exe: main.o exe.o \newline (tab) g++ -g main.o exe.o -o exe \newline \newline main.o: main.cpp exe.h \newline (tab) g++ -Wall -c main.cpp \newline \newline exe.o: exe.cpp exe.h \newline (tab) g++ -Wall -c exe.cpp} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{p{0.4977 cm} p{0.4977 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Input/Output with \textgreater{}\textgreater{} \& \textless{}\textless{}}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{} \tn % Row Count 0 (+ 0) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{- out\_stream \textless{}\textless{} 34 \textless{}\textless{} ' ' would result in '3', '4', ' ' as characters in output file \newline \newline - doing input\_stream \textgreater{}\textgreater{} number would take all characters together until reaching a blank space \newline \newline - \textgreater{}\textgreater{} skips over blank space no matter the data type} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Arrays}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{- When declaring a function that passes an array use {[}{]} \newline % Row Count 2 (+ 2) - When passing actual array to function no need to use {[}{]} \newline % Row Count 4 (+ 2) - Array parameters are essentially reference parameters but not need to use \& \newline % Row Count 6 (+ 2) - Pass the size of the array in the function as well \newline % Row Count 8 (+ 2) - Add const before array in function if you don't want it to change the array e.g. const int array\_name{[}{]} \newline % Row Count 11 (+ 3) - 2D arrays -\textgreater{} int array\_name{[}row{]}{[}column{]} \newline % Row Count 12 (+ 1) - function(array{[}{]}{[}column{]})% Row Count 13 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Header file (function declarations)}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{\#ifndef HEADERNAME\_H \newline \#define HEADERNAME\_H \newline \newline \#include directives \newline Using directives \newline \newline statements \newline \newline \#endif} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Another Makefile}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{OBJ = main.o tube.o helper.o \newline EXE = tube \newline CXX = g++ \newline CXXFLAGS = -Wall -g \newline \newline \$(EXE): \$(OBJ) \newline \$(CXX) \$(OBJ) -o \$@ \newline \newline \%.o: \%.cpp \newline \$(CXX) \$(CXXFLAGS) -c \$\textless{} \newline \newline main.o: tube.h \newline \newline tube.o: tube.h helper.h \newline \newline helper.o: helper.h \newline \newline clean: \newline rm -f \$(OBJ) \$(EXE)} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}