<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Char int umwandlung]]></title><description><![CDATA[<p>Hallo,<br />
ich habe eine Funktion die benötigt char als Parameter. Nun möchte ich der Funktion eine Zahl übergeben (0-9). Wie wandle ich das jetzt in ein char um? Also nciht das ASCII Zeichen '0', sondern ich möchte eine 0 übergeben.</p>
<p>Danke</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/267119/char-int-umwandlung</link><generator>RSS for Node</generator><lastBuildDate>Wed, 02 Sep 2026 15:48:25 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/267119.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 19 May 2010 14:14:50 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Char int umwandlung on Wed, 19 May 2010 14:14:50 GMT]]></title><description><![CDATA[<p>Hallo,<br />
ich habe eine Funktion die benötigt char als Parameter. Nun möchte ich der Funktion eine Zahl übergeben (0-9). Wie wandle ich das jetzt in ein char um? Also nciht das ASCII Zeichen '0', sondern ich möchte eine 0 übergeben.</p>
<p>Danke</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1899562</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1899562</guid><dc:creator><![CDATA[Peter H.]]></dc:creator><pubDate>Wed, 19 May 2010 14:14:50 GMT</pubDate></item><item><title><![CDATA[Reply to Char int umwandlung on Wed, 19 May 2010 14:20:22 GMT]]></title><description><![CDATA[<p>'0' - '0' = 0<br />
'1' - '0' = 1<br />
'2' - '0' = 2<br />
'3' - '0' = 3<br />
'4' - '0' = 4<br />
'5' - '0' = 5<br />
'6' - '0' = 6<br />
'7' - '0' = 7<br />
'8' - '0' = 8<br />
'9' - '0' = 9</p>
<p>Bitte unterscheide in Zukunft auch zwischen einer <strong>Zahl</strong> und einer <strong>Ziffer</strong>.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1899566</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1899566</guid><dc:creator><![CDATA[Janjan]]></dc:creator><pubDate>Wed, 19 May 2010 14:20:22 GMT</pubDate></item><item><title><![CDATA[Reply to Char int umwandlung on Wed, 19 May 2010 14:24:11 GMT]]></title><description><![CDATA[<p>möchtest du char in int oder int in char?</p>
<p>mfg Luis</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1899569</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1899569</guid><dc:creator><![CDATA[sulpsulp-c]]></dc:creator><pubDate>Wed, 19 May 2010 14:24:11 GMT</pubDate></item><item><title><![CDATA[Reply to Char int umwandlung on Wed, 19 May 2010 14:25:46 GMT]]></title><description><![CDATA[<p>oh ich hab janjans beitrag erst nacher gelesen aber so hätt ichs auch gemacht</p>
<p>mfg luis</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1899570</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1899570</guid><dc:creator><![CDATA[sulpsulp-c]]></dc:creator><pubDate>Wed, 19 May 2010 14:25:46 GMT</pubDate></item><item><title><![CDATA[Reply to Char int umwandlung on Wed, 19 May 2010 14:35:15 GMT]]></title><description><![CDATA[<p>int kann implizit nach char gecastet werden, du musst also gar nichts machen. Einfach 0 übergeben.<br />
Explizit kannst du es mit static_cast&lt;char&gt;(0) machen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1899577</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1899577</guid><dc:creator><![CDATA[Athar]]></dc:creator><pubDate>Wed, 19 May 2010 14:35:15 GMT</pubDate></item><item><title><![CDATA[Reply to Char int umwandlung on Wed, 19 May 2010 15:31:04 GMT]]></title><description><![CDATA[<p>Athar schrieb:</p>
<blockquote>
<p>int kann implizit nach char gecastet werden, du musst also gar nichts machen. Einfach 0 übergeben.<br />
Explizit kannst du es mit static_cast&lt;char&gt;(0) machen.</p>
</blockquote>
<p>Nur dann hat er nicht das, was er will. Er will nicht casten, sondern konvertieren. Und zwar das Zeichen einer Ziffer in die entsprechende Zahl.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1899607</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1899607</guid><dc:creator><![CDATA[Janjan]]></dc:creator><pubDate>Wed, 19 May 2010 15:31:04 GMT</pubDate></item><item><title><![CDATA[Reply to Char int umwandlung on Wed, 19 May 2010 15:34:16 GMT]]></title><description><![CDATA[<p>Janjan schrieb:</p>
<blockquote>
<p>Nur dann hat er nicht das, was er will. Er will nicht casten, sondern konvertieren. Und zwar das Zeichen einer Ziffer in die entsprechende Zahl.</p>
</blockquote>
<p>Nö. Er will den Wert 0 an einen char-Parameter übergeben, steht da. Da steht nichts davon, dass er vorher ein Zeichen '0' hat.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1899609</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1899609</guid><dc:creator><![CDATA[pumuckl]]></dc:creator><pubDate>Wed, 19 May 2010 15:34:16 GMT</pubDate></item><item><title><![CDATA[Reply to Char int umwandlung on Wed, 19 May 2010 16:58:48 GMT]]></title><description><![CDATA[<p>was soll eigentlich dann im char stehen?</p>
<p>beim impliziten cast in char steht im char natürlich dann nicht '0' sondern 0.<br />
Wenn du den char dann direkt ausgibst, wirst nicht viel sehen. Den müsstest du explizit dann wieder in einen int zurückcasten.</p>
<p>so wie ich dich verstanden hab, möchtest du, dass der Wert an sich erhalten bleibt?</p>
<pre><code class="language-cpp">void foo(char a)
{
	cout &lt;&lt; a &lt;&lt; endl;
}

int main()
{
	int x = 2;

	foo(x+48);

	return 0;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1899668</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1899668</guid><dc:creator><![CDATA[BasicMan01]]></dc:creator><pubDate>Wed, 19 May 2010 16:58:48 GMT</pubDate></item></channel></rss>