\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{jofre pla} \pdfinfo{ /Title (c-for-beginners.pdf) /Creator (Cheatography) /Author (jofre pla) /Subject (C++ for beginners 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}{1241FF} \definecolor{LightBackground}{HTML}{F0F3FF} \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++ for beginners Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{jofre pla} via \textcolor{DarkBackground}{\uline{cheatography.com/26595/cs/7478/}}} \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}jofre pla \\ \uline{cheatography.com/jofre-pla} \\ \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Published 4th April, 2016.\\ Updated 19th May, 2016.\\ 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{2.43873 cm} x{2.53827 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Include Headers}} \tn % Row 0 \SetRowColor{LightBackground} \#include & \textless{}headerfile\textgreater{} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{2}{x{5.377cm}}{{\bf{\{\{ac\}\}Common Headers / Libraries}}} \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} \{\{nobreak\}\}\#include \textless{}stdio.h\textgreater{} & I / O functions \tn % Row Count 4 (+ 2) % Row 3 \SetRowColor{white} \{\{nobreak\}\}\#include \textless{}string.h\textgreater{} & string functions \tn % Row Count 6 (+ 2) % Row 4 \SetRowColor{LightBackground} \{\{nobreak\}\}\#include \textless{}time.h\textgreater{} & time functions \tn % Row Count 8 (+ 2) % Row 5 \SetRowColor{white} \{\{nobreak\}\}\#include \textless{}stdlib.h\textgreater{} & memory, rand, ... \tn % Row Count 10 (+ 2) % Row 6 \SetRowColor{LightBackground} \{\{nobreak\}\}\#include \textless{}math.h\textgreater{} & math functions \tn % Row Count 12 (+ 2) % Row 7 \SetRowColor{white} \mymulticolumn{2}{x{5.377cm}}{\{\{nobreak\}\}\#include \textless{}iostream.h\textgreater{}} \tn % Row Count 13 (+ 1) % Row 8 \SetRowColor{LightBackground} \{\{nobreak\}\}\#include \textless{}fstream.h\textgreater{} & I / O file functions \tn % Row Count 15 (+ 2) % Row 9 \SetRowColor{white} \{\{nobreak\}\}\#include "myfile.h" & Insert file in current directory \tn % Row Count 17 (+ 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}{Namespaces}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{using namespace std;} \tn % Row Count 1 (+ 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}{Comments}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{// One line comment text} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{/* multiple line block comment text */} \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}{Basic Variable Types}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{NUMBER} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}\{\{nobreak\}\}int a; float a;} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{CHARACTER} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}\{\{nobreak\}\}char car; string s; \{\{nl\}\}char car = 'c'; string s = "hola mon";} \tn % Row Count 5 (+ 3) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{BOOL} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}\{\{nobreak\}\}bool b = false/true;} \tn % Row Count 7 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{p{0.4977 cm} x{4.4793 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Basic input / Output Operators}} \tn % Row 0 \SetRowColor{LightBackground} cin & cin \textgreater{}\textgreater{} var \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} cout & \{\{nobreak\}\}cout\textless{}\textless{}"The variable has"\textless{}\textless{}var \tn % Row Count 3 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.4885 cm} x{2.4885 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Basic Operators / Math Operators}} \tn % Row 0 \SetRowColor{LightBackground} \seqsplit{+~~~~~~~~~~~~~~~~~~Add} & \seqsplit{-~~~~~~~~~~~~~~~~~~Less} \tn % Row Count 6 (+ 6) % Row 1 \SetRowColor{white} \seqsplit{*~~~~~~~~~~~~~~~~~~Mult} & \seqsplit{/~~~~~~~~~~~~~~~~~~Div} \tn % Row Count 12 (+ 6) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{\%~~~~~~~~~~~~~~~~~~Mod} \tn % Row Count 15 (+ 3) % Row 3 \SetRowColor{white} ++var / -{}-var & var++ / var-{}- \tn % Row Count 16 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.4931 cm} x{3.4839 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Conditionals}} \tn % Row 0 \SetRowColor{LightBackground} \{\{nobreak\}\}A == B & if A is equal to B, this is true; otherwise, it's false \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} \{\{nobreak\}\}A != B & if A is NOT equal to B, this is true; otherwise, it's false \tn % Row Count 6 (+ 3) % Row 2 \SetRowColor{LightBackground} \{\{nobreak\}\}A \textless{} B & if A is less than B, this is true; otherwise, it's false \tn % Row Count 9 (+ 3) % Row 3 \SetRowColor{white} \{\{nobreak\}\}A \textgreater{} B & if A is greater B, this is true; otherwise, it's false \tn % Row Count 11 (+ 2) % Row 4 \SetRowColor{LightBackground} \{\{nobreak\}\}A \textless{}= B & if A is less than or equal to B, this is true; otherwise, it's false \tn % Row Count 14 (+ 3) % Row 5 \SetRowColor{white} \{\{nobreak\}\}A \textgreater{}= B & if A is greater or equal to B, this is true; otherwise, it's false \tn % Row Count 17 (+ 3) % Row 6 \SetRowColor{LightBackground} \{\{nobreak\}\}A ! B & if A \tn % Row Count 19 (+ 2) % Row 7 \SetRowColor{white} \{\{nobreak\}\}A \&\& B & if condition A and condition B are true, this is true; otherwise, it's false. \tn % Row Count 22 (+ 3) % Row 8 \SetRowColor{LightBackground} \{\{nobreak\}\}A || B & if condition A or condition B is true, this is true; otherwise, it's false. \tn % Row Count 25 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{Boolean expres​sions in C++ are evaluated left t​o r​ight!} \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 % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{type array\_name {[} \# of elements {]};} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}int price {[}10{]};} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{type array\_name {[}\# elements{]} {[}\# elements{]};} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}int price {[}5{]} {[}10{]};} \tn % Row Count 4 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{· Array index starts at 0. \newline · Ex: Access 3rd element : cout\textless{}\textless{}price {[}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}{Column Breack}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{} \tn % Row Count 0 (+ 0) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{p{0.64701 cm} x{4.32999 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Control Flow}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{{\bf{if sentence}}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} ~ & \{\{nobreak\}\}{\bf{if}} ( conditional ) \{ \{\{nl\}\} ~~~// do something \{\{nl\}\} \} \{\{nl\}\} {\bf{else if}} ( another\_conditional ) \{ \{\{nl\}\} ~~~// do something else \{\{nl\}\} \} \{\{nl\}\} {\bf{else}} \{ \{\{nl\}\}~~~// do something as default \{\{nl\}\} \} \tn % Row Count 9 (+ 8) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{{\bf{while sentence}}} \tn % Row Count 10 (+ 1) % Row 3 \SetRowColor{white} ~ & {\bf{while}} ( conditional ) \{ \{\{nl\}\} // do something \{\{nl\}\} \} \{\{nl\}\} placing {\bf{"break;"}} breaks out of the loop. \{\{nl\}\} placing {\bf{"continue;"}} jumps to next loop. \tn % Row Count 16 (+ 6) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{{\bf{for sentence}}} \tn % Row Count 17 (+ 1) % Row 5 \SetRowColor{white} ~ & {\bf{for}} ( init; test; command ) \{ \{\{nl\}\}~~~// do something \{\{nl\}\} \} \{\{nl\}\} {\bf{"break;"}} and {\bf{"continue;"}} identical effects. \tn % Row Count 22 (+ 5) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{{\bf{do while sentence}}} \tn % Row Count 23 (+ 1) % Row 7 \SetRowColor{white} ~ & {\bf{do}} \{ \{\{nl\}\} ~~~//do something \{\{nl\}\} \} {\bf{while }}(bool expression); \tn % Row Count 26 (+ 3) % Row 8 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{{\bf{switch case sentence}}} \tn % Row Count 27 (+ 1) % Row 9 \SetRowColor{white} ~ & {\bf{switch}} ( variable ) \{\{nl\}\} \{ \{\{nl\}\} {\bf{case value1:}} \{\{nl\}\} ~~~// do something; \{\{nl\}\} ~~~break; \{\{nl\}\} {\bf{case value2:}} \{\{nl\}\} ~~~// do something else; \{\{nl\}\} ~~~break; \{\{nl\}\} {[}{\bf{default: }}\{\{nl\}\} ~~~// do something by default: \{\{nl\}\} ~~~break; {]}\{\{nl\}\} \} \tn % Row Count 38 (+ 11) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Column Breack}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{} \tn % Row Count 0 (+ 0) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{File Input / Output}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{\#include \textless{}fstream.h\textgreater{} \newline \newline ifstream file; //read buffer \newline ofstream file; //write buffer \newline \newline file.open ("filename", {[}file mode constant{]}); \newline \newline {\emph{ //Test if the file was created }} \newline if(fs.is\_open())~~~~~if(fs) \newline \newline {\emph{//Reads/Writes like cin and cout}} \newline file \textgreater{}\textgreater{} var; //Read \newline file \textless{}\textless{} ''Text: "\textless{}\textless{} var \textless{}\textless{} endl; //Write \newline \newline {\emph{//Read Entire line}} \newline getline (file,String); \newline \newline {\emph{//Read until it arrives at the end of file}} \newline while(file.eof()) \newline \newline {\emph{//Detect if the read/write fail}} \newline if(file.fail()) \newline \newline {\emph{//Close File}} \newline file.close();} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{File Mode Constants}} \newline ios::in //Opens file for reading \newline ios::out //Opens file for writing \newline ios::app //Causes output to be appended at EOF \newline ios::trunc //Destroys the previous contents \newline ios::nocreate //Causes open() to fail if file doesn't already exist \newline ios::noreplace //Causes open() to fail if file already exists} \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}{Column Breack}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{} \tn % Row Count 0 (+ 0) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Procedures}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\emph{ //Declaration}} \newline {\bf{ {\emph{void}} ProcedureName()}} \newline \{ \newline ~~~// do something \newline \} \newline \newline {\emph{//Call to procedure}} \newline {\bf{ProcedureName();}}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{In the procedures we don't receive variables and don't return other variable.} \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}{Functions}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\emph{//Declaration}} \newline {\bf{ {[}{\emph{returnType}}{]} functionName ( {[}{\emph{input1Type}} input1Name, {\emph{input2Type}} input2Name, ....{]} ) }} \newline \{ \newline ~~~// do something \newline ~~~return value; // value must be of type returnType \newline \} \newline \newline {\emph{//Call to function}} \newline {\bf{{[}returntype var ={]} functionName ({[}{\emph{input1Type}} input1Name, {\emph{input2Type}} input2Name, ....{]})}}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{We have two methods to create and call functions: \newline passed with values and passed for reference. \newline {\bf{Pass by reference}} : we put {\emph{\&}} before variable in the declaration.} \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}{Column Breack}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{} \tn % Row Count 0 (+ 0) \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}{Structures}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{Structure declaration :} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{2}{x{5.377cm}}{{\bf{struct}} \textless{}structure\_name\textgreater{} \{\{nl\}\} \{ \{\{nl\}\}~~~ \textless{}type\textgreater{} \textless{}name\textgreater{}, \textless{}name\textgreater{}, ... ; \{\{nl\}\}~~~ \textless{}type\textgreater{} \textless{}name\textgreater{}, \textless{}name\textgreater{}, ... ; \{\{nl\}\}\}} \tn % Row Count 5 (+ 4) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{Var declaration with structure type :} \tn % Row Count 6 (+ 1) % Row 3 \SetRowColor{white} \mymulticolumn{2}{x{5.377cm}}{\textless{}structure\_name\textgreater{} var\_name;} \tn % Row Count 7 (+ 1) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{Acces to structure :} \tn % Row Count 8 (+ 1) % Row 5 \SetRowColor{white} \mymulticolumn{2}{x{5.377cm}}{var\_name.name;} \tn % Row Count 9 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}