pointeur.svg

2025-09-12 13:33:16 +02:00
parent 35d8090ac9
commit 7b2108aac1
3 changed files with 119 additions and 120 deletions

@@ -1,6 +1,4 @@
---
title: Les pointeurs
---
# Les pointeurs
Les pointeurs avec une fonction.
Solution plus efficace : on passe en paramètre deux pointeurs.

117
pointeur.svg Normal file

@@ -0,0 +1,117 @@
<svg viewbox="0 0 300 330" width="300">
<defs
id="defs84">
<marker
style="overflow:visible;"
id="Arrow1Send"
refX="0.0"
refY="0.0"
orient="auto">
<path
transform="scale(0.2) rotate(180) translate(6,0)"
style="fill-rule:evenodd;fill:context-stroke;stroke:context-stroke;stroke-width:1.0pt;"
d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
id="path4681" />
</marker>
<marker
style="overflow:visible"
id="Arrow1Sstart"
refX="0.0"
refY="0.0"
orient="auto">
<path
transform="scale(0.2) translate(6,0)"
style="fill-rule:evenodd;fill:context-stroke;stroke:context-stroke;stroke-width:1.0pt"
d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
id="path4678" />
</marker>
<marker
style="overflow:visible;"
id="Arrow1Lend"
refX="0.0"
refY="0.0"
orient="auto">
<path
transform="scale(0.8) rotate(180) translate(12.5,0)"
style="fill-rule:evenodd;fill:context-stroke;stroke:context-stroke;stroke-width:1.0pt;"
d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
id="path4669" />
</marker>
<marker
style="overflow:visible;"
id="Arrow2Lend"
refX="0.0"
refY="0.0"
orient="auto">
<path
transform="scale(1.1) rotate(180) translate(1,0)"
d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z "
style="fill-rule:evenodd;fill:context-stroke;stroke-width:0.62500000;stroke-linejoin:round;"
id="path4687" />
</marker>
<style>
.rect {
fill: none;
stroke: black;
stroke-width: 1px;
}
.ligne {
stroke: black;
stroke-width: 0.5px;
}
text.address { font-size:11px; }
.variable { fill: #ffcc44; }
</style>
</defs>
<text x="0" y="0" class="address">
<tspan x="0" y="14">10000</tspan>
<tspan x="0" y="34">10001</tspan>
<tspan x="0" y="54">10002</tspan>
<tspan x="0" y="74">10003</tspan>
<tspan x="0" y="94">10004</tspan>
<tspan x="0" y="114">10005</tspan>
<tspan x="0" y="134">10006</tspan>
<tspan x="0" y="154">10007</tspan>
<tspan x="0" y="174">10008</tspan>
<tspan x="0" y="194">10009</tspan>
<tspan x="0" y="214">10010</tspan>
<tspan x="0" y="234">10011</tspan>
<tspan x="0" y="254">10012</tspan>
<tspan x="0" y="274">10013</tspan>
<tspan x="0" y="294">10014</tspan>
<tspan x="0" y="314">10015</tspan>
</text>
<rect x="40" y="60" width="90" height="80" class="variable"/>
<text x="0" y="0">
<tspan x="45" y="15">0000 1100</tspan>
<tspan x="45" y="35">0100 0000</tspan>
<tspan x="45" y="55">0000 0100</tspan>
<tspan x="45" y="75">1100 1001</tspan>
<tspan x="45" y="95">0110 1110</tspan>
<tspan x="45" y="115">1110 0000</tspan>
<tspan x="45" y="135">0000 0011</tspan>
<tspan x="45" y="155">1100 0000</tspan>
<tspan x="45" y="175">0010 0000</tspan>
<tspan x="45" y="195">0000 0000</tspan>
<tspan x="45" y="215">0000 1111</tspan>
<tspan x="45" y="235">1001 0000</tspan>
<tspan x="45" y="255">0000 0000</tspan>
<tspan x="45" y="275">0000 0000</tspan>
<tspan x="45" y="295">0110 0000</tspan>
<tspan x="45" y="315">0000 0000</tspan>
</text>
<rect x="40" y="1" width="90" height="320" class="rect"/>
<path d="M40,20h75 M40,40h75 M40,60h75 M40,80h75 M40,100h75 M40,120h75 M40,140h75 M40,160h75 M40,180h75 M40,200h75 M40,220h75 M40,240h75 M40,260h75 M40,280h75 M40,300h75" class="ligne"/>
<path
style="fill:none;stroke:#000;stroke-width:1.5px;stroke-opacity:1"
d="M 118,60 c 8,0 8,4 8,20
0,8 0,20 8,20
-8,0 -8,10 -8,20
0,16 0,20 -8,20" />
<path
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
d="M 134.3373,22.772575 35.934705,64.97496"
/>
<text x="140" y="105">score</text>
<text x="140" y="25">*pointeur</text>
</svg>

After

Width:  |  Height:  |  Size: 4.1 KiB

@@ -10,123 +10,7 @@ int score = 65040073;
int *pointeur = &score;
```
<svg viewbox="0 0 300 330" width="300">
<defs
id="defs84">
<marker
style="overflow:visible;"
id="Arrow1Send"
refX="0.0"
refY="0.0"
orient="auto">
<path
transform="scale(0.2) rotate(180) translate(6,0)"
style="fill-rule:evenodd;fill:context-stroke;stroke:context-stroke;stroke-width:1.0pt;"
d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
id="path4681" />
</marker>
<marker
style="overflow:visible"
id="Arrow1Sstart"
refX="0.0"
refY="0.0"
orient="auto">
<path
transform="scale(0.2) translate(6,0)"
style="fill-rule:evenodd;fill:context-stroke;stroke:context-stroke;stroke-width:1.0pt"
d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
id="path4678" />
</marker>
<marker
style="overflow:visible;"
id="Arrow1Lend"
refX="0.0"
refY="0.0"
orient="auto">
<path
transform="scale(0.8) rotate(180) translate(12.5,0)"
style="fill-rule:evenodd;fill:context-stroke;stroke:context-stroke;stroke-width:1.0pt;"
d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
id="path4669" />
</marker>
<marker
style="overflow:visible;"
id="Arrow2Lend"
refX="0.0"
refY="0.0"
orient="auto">
<path
transform="scale(1.1) rotate(180) translate(1,0)"
d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z "
style="fill-rule:evenodd;fill:context-stroke;stroke-width:0.62500000;stroke-linejoin:round;"
id="path4687" />
</marker>
<style>
.rect {
fill: none;
stroke: black;
stroke-width: 1px;
}
.ligne {
stroke: black;
stroke-width: 0.5px;
}
text.address { font-size:11px; }
.variable { fill: #ffcc44; }
</style>
</defs>
<text x="0" y="0" class="address">
<tspan x="0" y="14">10000</tspan>
<tspan x="0" y="34">10001</tspan>
<tspan x="0" y="54">10002</tspan>
<tspan x="0" y="74">10003</tspan>
<tspan x="0" y="94">10004</tspan>
<tspan x="0" y="114">10005</tspan>
<tspan x="0" y="134">10006</tspan>
<tspan x="0" y="154">10007</tspan>
<tspan x="0" y="174">10008</tspan>
<tspan x="0" y="194">10009</tspan>
<tspan x="0" y="214">10010</tspan>
<tspan x="0" y="234">10011</tspan>
<tspan x="0" y="254">10012</tspan>
<tspan x="0" y="274">10013</tspan>
<tspan x="0" y="294">10014</tspan>
<tspan x="0" y="314">10015</tspan>
</text>
<rect x="40" y="60" width="90" height="80" class="variable"/>
<text x="0" y="0">
<tspan x="45" y="15">0000 1100</tspan>
<tspan x="45" y="35">0100 0000</tspan>
<tspan x="45" y="55">0000 0100</tspan>
<tspan x="45" y="75">1100 1001</tspan>
<tspan x="45" y="95">0110 1110</tspan>
<tspan x="45" y="115">1110 0000</tspan>
<tspan x="45" y="135">0000 0011</tspan>
<tspan x="45" y="155">1100 0000</tspan>
<tspan x="45" y="175">0010 0000</tspan>
<tspan x="45" y="195">0000 0000</tspan>
<tspan x="45" y="215">0000 1111</tspan>
<tspan x="45" y="235">1001 0000</tspan>
<tspan x="45" y="255">0000 0000</tspan>
<tspan x="45" y="275">0000 0000</tspan>
<tspan x="45" y="295">0110 0000</tspan>
<tspan x="45" y="315">0000 0000</tspan>
</text>
<rect x="40" y="1" width="90" height="320" class="rect"/>
<path d="M40,20h75 M40,40h75 M40,60h75 M40,80h75 M40,100h75 M40,120h75 M40,140h75 M40,160h75 M40,180h75 M40,200h75 M40,220h75 M40,240h75 M40,260h75 M40,280h75 M40,300h75" class="ligne"/>
<path
style="fill:none;stroke:#000;stroke-width:1.5px;stroke-opacity:1"
d="M 118,60 c 8,0 8,4 8,20
0,8 0,20 8,20
-8,0 -8,10 -8,20
0,16 0,20 -8,20" />
<path
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
d="M 134.3373,22.772575 35.934705,64.97496"
/>
<text x="140" y="105">score</text>
<text x="140" y="25">*pointeur</text>
</svg>
![Pointeur](pointeur.svg)
La déclaration d'un pointeur s'effectue en utilisant le symbole `*` appelé indirection.