From 3cafb75078e13fe14a4a5980c7c42363ba043f5c Mon Sep 17 00:00:00 2001 From: Orestis <orestis.malaspinas@hesge.ch> Date: Thu, 10 Oct 2019 11:07:27 +0200 Subject: [PATCH] added begining of strings. table not working yet --- Makefile | 5 ++++- strings.md | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 strings.md diff --git a/Makefile b/Makefile index 4875b82..8da76e1 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,7 @@ HTMLOPTIONS += -t html5 HTMLOPTIONS += -c css/tufte-css/tufte.css HTMLOPTIONS += --self-contained -all: tests_assertions.pdf make.pdf base_3.pdf base_2.pdf base_1.pdf intro.pdf index.html +all: strings.pdf tests_assertions.pdf make.pdf base_3.pdf base_2.pdf base_1.pdf intro.pdf index.html intro.pdf: intro.md metadata.yaml pandoc $(PDFOPTIONS) -o $@ $^ @@ -39,6 +39,9 @@ make.pdf: make.md metadata.yaml tests_assertions.pdf: tests_assertions.md metadata.yaml pandoc $(PDFOPTIONS) -o $@ $^ +strings.pdf: strings.md metadata.yaml + pandoc $(PDFOPTIONS) -o $@ $^ + index.html: index.md pandoc -s $(OPTIONS) $(HTMLOPTIONS) -o $@ $< diff --git a/strings.md b/strings.md new file mode 100644 index 0000000..2ed617a --- /dev/null +++ b/strings.md @@ -0,0 +1,36 @@ +% Chaînes de caractères +% Inspirés des slides de F. Glück +% 16 octobre 2019 + +# Rappel: le type `char`{.C} + +- Le type `char`{.C} est utilisé pour représenter un caractère. +- C'est un entier 8 bits signé. +- En particulier: + - Écrire + + ```C + char c = 'A'; + ``` + - Est équivalent à : + + ```C + char c = 65; + ``` +- Les fonctions d'affichage interprètent le nombre comme sa valeur ASCII. + +# Chaînes de caractères (strings) + +- Chaîne de caractère `==` tableaude caractères **terminé par la valeur `'\0'`{.C} ou `0`{.C} **. + +## Exemple + +```C +char str = "HELLO !"; +``` + +Est représenté par + +`H` | `E` | `L` | `L` | `O` | ` ` | `!` | `\0` | +=============================================== +`72` | `69` | `76` | `76` | `79` | `32` | `33` | `0` | \ No newline at end of file -- GitLab