\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{Alepok5} \pdfinfo{ /Title (langage-c-q1-henallux.pdf) /Creator (Cheatography) /Author (Alepok5) /Subject (Langage C Q1 Henallux 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}{A30A0A} \definecolor{LightBackground}{HTML}{FCF7F7} \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{Langage C Q1 Henallux Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{Alepok5} via \textcolor{DarkBackground}{\uline{cheatography.com/195239/cs/40858/}}} \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}Alepok5 \\ \uline{cheatography.com/alepok5} \\ \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 11th April, 2024.\\ 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{1.74195 cm} x{3.23505 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Basics}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{/ Note}} & Ceci permet de prendre note sans interférer avec le code \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} {\bf{/* Notes */}} & Sert à la même chose, sauf qu'ici on peut le faire sur plusieurs lignes \tn % Row Count 6 (+ 3) % Row 2 \SetRowColor{LightBackground} {\bf{\#include \textless{}stdio/h\textgreater{}}} & Permet d'inclure une bibliothèque {\emph{(ici la bibliothèque standard)}} \tn % Row Count 9 (+ 3) % Row 3 \SetRowColor{white} {\bf{\{\}}} & Bloc d'instruction \tn % Row Count 10 (+ 1) % Row 4 \SetRowColor{LightBackground} {\bf{,}} & séparer 2 éléments \tn % Row Count 11 (+ 1) % Row 5 \SetRowColor{white} {\bf{;}} & finir une instruction \tn % Row Count 12 (+ 1) % Row 6 \SetRowColor{LightBackground} {\bf{()}} & Introduire une fct°/Prioriter math \tn % Row Count 14 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.56312 cm} x{0.86963 cm} x{1.14425 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{5.377cm}}{\bf\textcolor{white}{Variable Attribution}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{int}} (entier) & \%d & \%d \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} {\bf{double}} (réel) & \%f & \%lf \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} {\bf{char}} (caract.) & \%c & \%c \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} {\bf{char{[}x+1{]}}} (chaine caract/) & \%s & \%s \tn % Row Count 5 (+ 2) % Row 4 \SetRowColor{LightBackground} {\bf{bool}} (booléen) & \seqsplit{Expression} & \seqsplit{conditionelle} \tn % Row Count 7 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}---} \SetRowColor{LightBackground} \mymulticolumn{3}{x{5.377cm}}{Attribuer variable dans fonction {\bf{printf}} \& {\bf{scanf}}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}---} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.94103 cm} x{3.03597 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Variable Tips}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{INT\_MAX/MIN}} & HV/LV -{}-\textgreater{} limits.h \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} {\bf{DBL\_MIN/MAX}} & HV/LV -{}-\textgreater{} float.h \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} \%{\bf{.2}}f (only for double) & le ".2" signifie que l'on veut 2 chiffres après la virgule \tn % Row Count 5 (+ 3) % Row 3 \SetRowColor{white} {\bf{\textbackslash{}n}} & Retour à la ligne \tn % Row Count 6 (+ 1) % Row 4 \SetRowColor{LightBackground} {\bf{\textbackslash{}t}} & Tabulation \tn % Row Count 7 (+ 1) \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}{Standard Functions}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{void main(void)}} & Fonction principale (sert à introduire un algorithme \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} {\bf{printf("")}} & Permet d'afficher du texte \tn % Row Count 5 (+ 2) % Row 2 \SetRowColor{LightBackground} {\bf{scanf\_s("", \&variable)}} & Permet de récupérer une entrée de l'user (S'arrête de récupérer si "SPACE") "\_s" = sécurisé \tn % Row Count 10 (+ 5) % Row 3 \SetRowColor{white} {\bf{gets\_s}}(variable, {\emph{const symbolique}}) & Permet de récupérer une entrée texte de l'user (Prend en compte les "SPACE") {\emph{("\_s" = cst symb.)}} \tn % Row Count 15 (+ 5) % Row 4 \SetRowColor{LightBackground} {\bf{getchar()}} & Permet d'enlever le texte qu'il y a dans le buffer \tn % Row Count 18 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{3.08574 cm} x{1.89126 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Advanced function}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{\textless{}Condition\textgreater{} ? \textless{}true\_value\textgreater{} : \textless{}false\_value\textgreater{}}} & Expression conditionnelle \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} {\bf{(double)variableNum * variableNum2}} & Casting \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} {\bf{switch (\textless{}variable\textgreater{})\{ case 1: \textless{}instructions\textgreater{}; break; \}}} & Switch case \tn % Row Count 7 (+ 3) \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}{Répétitive}} \tn % Row 0 \SetRowColor{LightBackground} {\emph{obtenir info}} {\bf{While (info != -1)}} -{}- {\emph{obtenir info}} & On connait pas le nombre d'itérations \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} {\bf{for (affectation ; condition ; màj)}} \{ \} & On connait le nombre d'intérations \tn % Row Count 6 (+ 3) % Row 2 \SetRowColor{LightBackground} {\bf{do}} {\emph{instructions}} {\bf{while (conditions)}} & Contrôle de saisie ou utilisation + pratique \tn % Row Count 9 (+ 3) \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}{String functions}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{strlen}}(\textless{}s\textgreater{}) & Nb caractères (sans l'espace vide) \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} {\bf{strcmp}}(\textless{}s\textgreater{}, \textless{}s\textgreater{}) & Compare (\textless{}/=/\textgreater{} 0) \tn % Row Count 3 (+ 1) % Row 2 \SetRowColor{LightBackground} {\bf{strcpy\_s}}(*\textless{}s\_new\textgreater{}, TAILLE, \textless{}s\_base\textgreater{}) & Remplacement de string \tn % Row Count 5 (+ 2) % Row 3 \SetRowColor{white} {\bf{toupper()}} \textasciitilde{} {\bf{tolower()}} & mettre en majuscule\textasciitilde{}minuscule un caractère ou une chaine de caract. \tn % Row Count 9 (+ 4) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{Possibilité de rajouté {\bf{n}} après str pour avoir {\bf{n}} caractères} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.24425 cm} x{3.73275 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Bibliothèques}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{stdio.h}} & Bibliothèque Standard (input/output) \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} {\bf{stdbool.h}} & Bibliothèque pour implémenter notamment la fonction "bool" \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} {\bf{limits.h}} & Bibliothèque pour min/max int (entier) \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} {\bf{float.h}} & Bibliothèque pour min/max double (réel) \tn % Row Count 8 (+ 2) % Row 4 \SetRowColor{LightBackground} {\bf{math.h}} & Bibliothèque pour les maths \tn % Row Count 9 (+ 1) % Row 5 \SetRowColor{white} {\bf{ctype.h}} & Bibliothèque pour toupper/tolower \tn % Row Count 11 (+ 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}{Structures}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{typedef struct \textless{}minuscule\textgreater{} \textless{}majuscule\textgreater{};}} & créer un raccourcis pour appeler la structure de ta structure \tn % Row Count 4 (+ 4) % Row 1 \SetRowColor{white} {\bf{struct \textless{}minuscule\textgreater{} \{ ... \};}} & définir la structure \tn % Row Count 6 (+ 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}{Pointeur}} \tn % Row 0 \SetRowColor{LightBackground} void * \textless{}pointeur\textgreater{} & déclarer un pointeur (void = type du pointeur) \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} {\emph{* }}(\textless{}type\textgreater{} *)\textless{}pointeur\textgreater{} = \textless{}variable\textgreater{} & si le pointeur a été déclaré en void (pour donner le type) \tn % Row Count 7 (+ 4) % Row 2 \SetRowColor{LightBackground} \textless{}tab\_dynamique\textgreater{} = (\textless{}type\textgreater{} {\emph{* }})malloc(sizeof(\textless{}type\textgreater{}) * \textless{}taille\textgreater{}) & Créer un tableau dynamique où on peut changer la taille via la variable taille \tn % Row Count 11 (+ 4) % Row 3 \SetRowColor{white} \textless{}struct\_Maj\textgreater{} * pSuiv; & cas de liste chainée (implémenter la poss. de passer au chainon suiv) \tn % Row Count 15 (+ 4) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}