Fin de cours de C

這個提交存在於:
Béranger 2021-09-29 11:53:56 +02:00
當前提交 9de1751f71
共有 4 個檔案被更改,包括 113 行新增0 行删除

二進制
C/Rappels/Images/binary_build.png 一般檔案

未顯示二進位檔案。

之後

寬度:  |  高度:  |  大小: 6.7 KiB

81
C/rappels.md 一般檔案
查看文件

@ -0,0 +1,81 @@
# Rappels de langage C
# Pointeurs
```
struct S {
int x;
int y
}
struct S v
v.x
struct S * p
p -> x
(*p).x // Plus correct mais plus long
```
Déclarer
```
char* ch = "OULA" // Ici on a une variable ch en mémoire qui est l'adresse d'un endroit en mémoire ReadOnly ou il y est écrit "OULA"
charch[]="OULA" // Ici on déclare la constante OULA en tant que variable locale.
// Ici char* ch ="OULA" correspond à une adresse. A EVITER.
```
**Si on tente de modifier une variable dans une zone ReadOnly, on a erreur à l'exécution**
<p align="center">
<img src="./Rappels/Images/binary_build.png">
</p>
# Passages d'arguments
Pour une fonction, si on souhaite modifier la valeur d'une variable en la passant en argument d'une fonction, il est impératif de passer l'adresse de la variable en argument et non pas sa valeur.
```
void fonction(int i){ i++;}
int j=5;
fonction(j);
printf("%d",j); // OUTPUT : 5;
//SI ON REMPLACE LA FONCTION DE CETTE FACON
void fonction(int* i){ i++;}
fonction(&j);
printf("%d",j); // OUTPUT : 6;
```
# printf
```
%d // int
%f // float
%c // char
%s // chaine de charactères
int i;
char ch;
char* str;
printf("%d, %c, %s", i , ch , str);
```
# Structures
##
```
struct s {
int e;
char ch[4];
} tab;
// Ici le type est struct s et on crée une variable tab de type struct s
typedef struct {
int e;
char ch[4];
}tab;
// Ici le type est tab et on ne crée en aucun cas une variable.
```

28
C/tmp.drawio 一般檔案
查看文件

@ -0,0 +1,28 @@
<mxfile host="65bd71144e">
<diagram id="p3NWl2w_Bpz-CquEactT" name="Page-1">
<mxGraphModel dx="527" dy="790" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
<root>
<mxCell id="0"/>
<mxCell id="1" parent="0"/>
<mxCell id="2" value="" style="whiteSpace=wrap;html=1;fillColor=none;strokeColor=#000000;strokeWidth=3;" vertex="1" parent="1">
<mxGeometry x="100" y="220" width="180" height="210" as="geometry"/>
</mxCell>
<mxCell id="3" value="" style="whiteSpace=wrap;html=1;fillColor=none;strokeColor=#000000;strokeWidth=3;" vertex="1" parent="1">
<mxGeometry x="100" y="180" width="180" height="40" as="geometry"/>
</mxCell>
<mxCell id="4" value="RAW DATA" style="text;html=1;resizable=0;autosize=1;align=center;verticalAlign=middle;points=[];fillColor=none;strokeColor=none;rounded=0;fontColor=#000000;fontStyle=1" vertex="1" parent="1">
<mxGeometry x="280" y="190" width="80" height="20" as="geometry"/>
</mxCell>
<mxCell id="5" value="OULA" style="whiteSpace=wrap;html=1;fillColor=none;strokeColor=#000000;strokeWidth=3;fontColor=#000000;fontStyle=1" vertex="1" parent="1">
<mxGeometry x="100" y="180" width="80" height="20" as="geometry"/>
</mxCell>
<mxCell id="7" value="O | U | L | A" style="whiteSpace=wrap;html=1;fillColor=none;strokeColor=#000000;strokeWidth=3;fontColor=#000000;fontStyle=1" vertex="1" parent="1">
<mxGeometry x="110" y="350" width="80" height="20" as="geometry"/>
</mxCell>
<mxCell id="8" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;fontColor=#000000;" edge="1" parent="1" source="7" target="7">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>

4
Crypto/intro.md 一般檔案
查看文件

@ -0,0 +1,4 @@
# Introduction à la Cryptographie
Responsable : vincent.migliore@insa-toulouse.fr
# Definitions