aboutsummaryrefslogtreecommitdiff
path: root/files/de/glossary/type_conversion/index.html
blob: e3267b4b88e13ac7f38bd1b457a8ce86da69bb16 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
---
title: Typumwandlung
slug: Glossary/Type_Conversion
tags:
  - CodingScripting
  - Glossary
  - Typ-Casting
  - Typ-Konvertierung
  - Typumwandlung
translation_of: Glossary/Type_Conversion
---
<p>Typumwandlung (oder Typ-Konvertierung) meint den Transfer von Daten aus Datentyp in einen anderen. <em>Implizite Umwandlung</em> geschieht, wenn der Kompiler automatisch Datentypen zuweist. Der Quellcode kann aber auch <em>explizit</em> die Umwandlung von Typen festlegen.</p>

<h4 id="Beispiel">Beispiel</h4>

<p>Gegeben sein die folgende Anweisungen:</p>

<pre class="syntaxbox">var a = 5 + 2.0;
var b = Number("0x11");
</pre>

<p>(a) Die Gleitkommazahl (<code>float</code>) 2.0 wird hier implizit ein eine Ganzzahl (<code>integer</code>) umgewandelt.</p>

<p>(b) Der String <code>0x11</code> wird explizit in die Ganzzahl <code>17</code> umgewandelt.</p>

<section id="Quick_links">
<ol>
 <li><a href="/de/docs/Glossary">Glossar</a>

  <ol>
   <li><a href="/de/docs/Glossary/Typ">Typ</a></li>
   <li>{{Glossary("Type coercion")}}</li>
  </ol>
 </li>
 <li>Wikipedia Artikel
  <ol>
   <li>{{Interwiki("wikipedia", "Typumwandlung")}}</li>
  </ol>
 </li>
</ol>
</section>