\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{TimSch} \pdfinfo{ /Title (c-datentypen-und-operatoren.pdf) /Creator (Cheatography) /Author (TimSch) /Subject (C - Datentypen und Operatoren 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}{A32D15} \definecolor{LightBackground}{HTML}{F9F1F0} \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 - Datentypen und Operatoren Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{TimSch} via \textcolor{DarkBackground}{\uline{cheatography.com/29480/cs/8646/}}} \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}TimSch \\ \uline{cheatography.com/timsch} \\ \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Published 23rd July, 2016.\\ Updated 28th July, 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*}{2} \begin{tabularx}{8.4cm}{x{1.672 cm} x{2.964 cm} x{2.964 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{8.4cm}}{\bf\textcolor{white}{Datentypen}} \tn % Row 0 \SetRowColor{LightBackground} \{\{nobreak\}\}{\bf{Datentyp}} & \{\{nobreak\}\}{\bf{Mindestwertebereich}} & {\bf{typischer Wertebereich}} \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} char & -127 - 127 & -128 - 127 \tn % Row Count 4 (+ 1) % Row 2 \SetRowColor{LightBackground} short & -32.767 - 32.767 & -32.767 - 32.767 \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} int & \{\{nobreak\}\}-32.767 - 32.767 & \{\{nobreak\}\}-2.147.483.648 - 2.147.483.647 \tn % Row Count 9 (+ 3) % Row 4 \SetRowColor{LightBackground} long & -2.147.483.647 - 2.147.483.647 & -2.147.483.647 - 2.147.483.647 \tn % Row Count 11 (+ 2) % Row 5 \SetRowColor{white} long long & \seqsplit{-9.223.372.036.854.775.807} - \seqsplit{9.223.372.036.854.775.807} & \seqsplit{-9.223.372.036.854.775.807} - \seqsplit{9.223.372.036.854.775.807} \tn % Row Count 15 (+ 4) % Row 6 \SetRowColor{LightBackground} \seqsplit{unsigned} char & 0-255 & 0-255 \tn % Row Count 17 (+ 2) % Row 7 \SetRowColor{white} \seqsplit{unsigned} short & 0 - 65.535 & 0 - 65.535 \tn % Row Count 19 (+ 2) % Row 8 \SetRowColor{LightBackground} \seqsplit{unsigned} int & 0 - 65.535 & 0 - 4.294.967.295 \tn % Row Count 21 (+ 2) % Row 9 \SetRowColor{white} \seqsplit{unsigned} long & 0 - 4.294.967.295 & 0 - 4.294.967.295 \tn % Row Count 23 (+ 2) % Row 10 \SetRowColor{LightBackground} \seqsplit{unsigned} long long & 0 - \seqsplit{18.446.744.073.709.551.615} & 0 - \seqsplit{18.446.744.073.709.551.615} \tn % Row Count 26 (+ 3) % Row 11 \SetRowColor{white} float & 10\textasciicircum{}-37\textasciicircum{} - 10\textasciicircum{}37\textasciicircum{} & 1.175494351*10\textasciicircum{}38\textasciicircum{} - 3.402823466*10\textasciicircum{}38\textasciicircum{} \tn % Row Count 29 (+ 3) % Row 12 \SetRowColor{LightBackground} double & 10\textasciicircum{}-37\textasciicircum{} - 10\textasciicircum{}37\textasciicircum{} & 2.2250738585072014*10\textasciicircum{}-308\textasciicircum{} - 1.7976931348623158*10\textasciicircum{}308\textasciicircum{} \tn % Row Count 33 (+ 4) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{1.672 cm} x{2.964 cm} x{2.964 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{8.4cm}}{\bf\textcolor{white}{Datentypen (cont)}} \tn % Row 13 \SetRowColor{LightBackground} long double & 10\textasciicircum{}-37\textasciicircum{} - 10\textasciicircum{}37\textasciicircum{} & 3.362103143112093506262677817321752602598*10\textasciicircum{}-4932\textasciicircum{} - 1.189731495357231765021263853030970205169*10\textasciicircum{}4932\textasciicircum{} \tn % Row Count 8 (+ 8) \hhline{>{\arrayrulecolor{DarkBackground}}---} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{4.72 cm} x{3.28 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Priorit{\"a}t von Operatoren}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{Operator}} & {\bf{Reihenfolge}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} {[} {]} \{\{nl\}\} ( ) \{\{nl\}\} . \{\{nl\}\} -\textgreater{} \{\{nl\}\} ++ -{}- (postfix) \{\{nl\}\} \{ \} & \{\{nobreak\}\}links nach rechts \tn % Row Count 4 (+ 3) % Row 2 \SetRowColor{LightBackground} ++ -{}- (prefix) \{\{nl\}\} sizeof \{\{nl\}\} \textasciitilde{} \{\{nl\}\} ! \{\{nl\}\} - + (als Vorzeichen) \{\{nl\}\} \& (Adressoperator) \{\{nl\}\} * (Variablenoperator) & rechts nach links \tn % Row Count 10 (+ 6) % Row 3 \SetRowColor{white} (type name) (Typkonvertierung) & rechts nach links \tn % Row Count 12 (+ 2) % Row 4 \SetRowColor{LightBackground} * / \% & links nach rechts \tn % Row Count 14 (+ 2) % Row 5 \SetRowColor{white} + - & links nach rechts \tn % Row Count 16 (+ 2) % Row 6 \SetRowColor{LightBackground} \textless{}\textless{} \textgreater{}\textgreater{} & links nach rechts \tn % Row Count 18 (+ 2) % Row 7 \SetRowColor{white} \textless{} \textgreater{} \textless{}= =\textgreater{} & links nach rechts \tn % Row Count 20 (+ 2) % Row 8 \SetRowColor{LightBackground} == != & links nach rechts \tn % Row Count 22 (+ 2) % Row 9 \SetRowColor{white} \& (bitweises UND) & links nach rechts \tn % Row Count 24 (+ 2) % Row 10 \SetRowColor{LightBackground} \textasciicircum{} (bitweises XOR) & links nach rechts \tn % Row Count 26 (+ 2) % Row 11 \SetRowColor{white} | (bitweises ODER) & links nach rechts \tn % Row Count 28 (+ 2) % Row 12 \SetRowColor{LightBackground} \&\& (logisches UND) & links nach rechts \tn % Row Count 30 (+ 2) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{4.72 cm} x{3.28 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Priorit{\"a}t von Operatoren (cont)}} \tn % Row 13 \SetRowColor{LightBackground} || (logisches ODER) & links nach rechts \tn % Row Count 2 (+ 2) % Row 14 \SetRowColor{white} ?: & rechts nach links \tn % Row Count 4 (+ 2) % Row 15 \SetRowColor{LightBackground} alle Zuweisungen wie \{\{nl\}\}=, +=, -=, ... & rechts nach links \tn % Row Count 6 (+ 2) % Row 16 \SetRowColor{white} , & links nach rechts \tn % Row Count 8 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{Oben h{\"o}chste Priorit{\"a}t, unten niedrigste.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{4.16 cm} x{3.84 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Zusammengesetzte Zuweisungsoperatoren}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{Bezeichnung}} & {\bf{Funktion}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} += & Addition \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} -= & Subtraktion \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} *= & Multiplikation \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} /= & Division \tn % Row Count 5 (+ 1) % Row 5 \SetRowColor{white} \%= & Modulo \tn % Row Count 6 (+ 1) % Row 6 \SetRowColor{LightBackground} \textless{}\textless{}= & Shift \tn % Row Count 7 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{{\bf{Beispiel:}} \newline x += 5; //Addiert 5 zur Variable x.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{3.12 cm} x{4.88 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{andere zusammengesetzte Operatoren}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{Bezeichnung}} & {\bf{Funktion}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} -\textgreater{} & Elementzugriff \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} ++ & Inkrement (+1) \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} -{}- & Dekrement (-1) \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} \textless{}\textless{} & Links-Schieben (Shift) \tn % Row Count 5 (+ 1) % Row 5 \SetRowColor{white} \textgreater{}\textgreater{} & Rechts-Schieben (Shift) \tn % Row Count 6 (+ 1) % Row 6 \SetRowColor{LightBackground} \textless{}= & kleiner gleich \tn % Row Count 7 (+ 1) % Row 7 \SetRowColor{white} \textgreater{}= & gr{\"o}{\ss}er gleich \tn % Row Count 8 (+ 1) % Row 8 \SetRowColor{LightBackground} == & Geichheit \tn % Row Count 9 (+ 1) % Row 9 \SetRowColor{white} != & Ungleichheit \tn % Row Count 10 (+ 1) % Row 10 \SetRowColor{LightBackground} \&\& & logisches UND \tn % Row Count 11 (+ 1) % Row 11 \SetRowColor{white} || & logisches ODER \tn % Row Count 12 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{4 cm} x{4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Konvertierung zwischen Datentypen}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{Umwandlung}} & {\bf{Beispiel}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} explizite Typumwandlung & `char c = 'A'; \{\{nl\}\} int i; \{\{nl\}\} i = (int) c;` \tn % Row Count 4 (+ 3) % Row 2 \SetRowColor{LightBackground} Ziffernzeichen in Ziffer konvertieren & \{\{nobreak\}\}`int i; \{\{nl\}\} i = (int) '5' - (int) '0';` \tn % Row Count 7 (+ 3) % Row 3 \SetRowColor{white} \{\{nobreak\}\}Gro{\ss}- in Kleinbuchstaben\{\{nl\}\}{\emph{implizite Typumwandlung}} & `char c = 'A'; \{\{nl\}\} c += 32;` \tn % Row Count 11 (+ 4) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{4 cm} x{4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Einzelne Operatoren}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{Bezeichnung}} & {\bf{Funktion}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} ! & logisches Nicht \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} \textasciitilde{} & bitweises NICHT \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} \& & bitweises UND \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} | & bitweises ODER \tn % Row Count 5 (+ 1) % Row 5 \SetRowColor{white} \textasciicircum{} & XOR \tn % Row Count 6 (+ 1) % Row 6 \SetRowColor{LightBackground} \% & Modulo (Rest) \tn % Row Count 7 (+ 1) % Row 7 \SetRowColor{white} * & Multiplikation \tn % Row Count 8 (+ 1) % Row 8 \SetRowColor{LightBackground} - & Subtraktion \tn % Row Count 9 (+ 1) % Row 9 \SetRowColor{white} + & Addition \tn % Row Count 10 (+ 1) % Row 10 \SetRowColor{LightBackground} / & Division \tn % Row Count 11 (+ 1) % Row 11 \SetRowColor{white} \textless{} & kleiner \tn % Row Count 12 (+ 1) % Row 12 \SetRowColor{LightBackground} \textgreater{} & gr{\"o}{\ss}er \tn % Row Count 13 (+ 1) % Row 13 \SetRowColor{white} = & Zuweisung \tn % Row Count 14 (+ 1) % Row 14 \SetRowColor{LightBackground} . & Elementzugriff \tn % Row Count 15 (+ 1) % Row 15 \SetRowColor{white} ? & Bedingung \tn % Row Count 16 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Wahrheitswerte (bool'sche Werte)}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{Werden für gew{\"o}hnlich als int dargestellt.} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{0 = falsch} \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{alles ungleich null = wahr} \tn % Row Count 3 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}