<?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[Warum geht string str = &amp;quot;&amp;quot;; aber char t =&#x27;&#x27;; nicht ?]]></title><description><![CDATA[<p>Hallo,</p>
<p>wenn ich</p>
<pre><code class="language-cpp">char t ='';
</code></pre>
<p>schreibe wirft mir der Compiler immer eine Fehler raus:</p>
<pre><code>error C2137: leere Zeichenkonstante
</code></pre>
<p>Warum wie kann man &quot;nichts&quot; in ein char schreiben ?</p>
<p>mfg</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/120454/warum-geht-string-str-quot-quot-aber-char-t-nicht</link><generator>RSS for Node</generator><lastBuildDate>Sat, 22 Aug 2026 07:37:30 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/120454.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 13 Sep 2005 12:49:42 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Warum geht string str = &amp;quot;&amp;quot;; aber char t =&#x27;&#x27;; nicht ? on Tue, 13 Sep 2005 12:49:42 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>wenn ich</p>
<pre><code class="language-cpp">char t ='';
</code></pre>
<p>schreibe wirft mir der Compiler immer eine Fehler raus:</p>
<pre><code>error C2137: leere Zeichenkonstante
</code></pre>
<p>Warum wie kann man &quot;nichts&quot; in ein char schreiben ?</p>
<p>mfg</p>
]]></description><link>https://www.c-plusplus.net/forum/post/871077</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/871077</guid><dc:creator><![CDATA[Habitant]]></dc:creator><pubDate>Tue, 13 Sep 2005 12:49:42 GMT</pubDate></item><item><title><![CDATA[Reply to Warum geht string str = &amp;quot;&amp;quot;; aber char t =&#x27;&#x27;; nicht ? on Tue, 13 Sep 2005 12:51:15 GMT]]></title><description><![CDATA[<p>weil nichts zu wenig ist.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/871083</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/871083</guid><dc:creator><![CDATA[&#x27;&#x27;]]></dc:creator><pubDate>Tue, 13 Sep 2005 12:51:15 GMT</pubDate></item><item><title><![CDATA[Reply to Warum geht string str = &amp;quot;&amp;quot;; aber char t =&#x27;&#x27;; nicht ? on Tue, 13 Sep 2005 12:54:43 GMT]]></title><description><![CDATA[<p>ein char hat halt genau 8 bits (auf deinem rechner). da fragt der compiler zu recht, wie er jedes dieser bits stellen soll. selbst wenn du<br />
char ch;<br />
schreibst, sind die bits irgendwie gestellt und du kannst cout&lt;&lt;int(ch); machen und da kommt was.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/871088</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/871088</guid><dc:creator><![CDATA[volkard]]></dc:creator><pubDate>Tue, 13 Sep 2005 12:54:43 GMT</pubDate></item><item><title><![CDATA[Reply to Warum geht string str = &amp;quot;&amp;quot;; aber char t =&#x27;&#x27;; nicht ? on Tue, 13 Sep 2005 12:58:29 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">char t = &quot;&quot;;
</code></pre>
<p>müsste gehen.<br />
Denn da fügt er noch ein /0 ein.</p>
<p>---<br />
EDIT: Oh sorry, geht doch nicht, war mit meinen Gedanken bei string <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/871090</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/871090</guid><dc:creator><![CDATA[michba]]></dc:creator><pubDate>Tue, 13 Sep 2005 12:58:29 GMT</pubDate></item><item><title><![CDATA[Reply to Warum geht string str = &amp;quot;&amp;quot;; aber char t =&#x27;&#x27;; nicht ? on Tue, 13 Sep 2005 13:03:17 GMT]]></title><description><![CDATA[<p>'Nichts' gibts nicht, 2 mögliche Interpretationen sind:</p>
<pre><code class="language-cpp">// 1. Alle Bits auf 0 setzen
char ch = 0;
// bzw.
char ch = '\0';

// 2. Leerzeichen, weil das dann am Bildschirm als &quot;nichts&quot; dargestellt wird
char ch = ' ';
</code></pre>
<p>MfG SideWinder</p>
]]></description><link>https://www.c-plusplus.net/forum/post/871100</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/871100</guid><dc:creator><![CDATA[SideWinder]]></dc:creator><pubDate>Tue, 13 Sep 2005 13:03:17 GMT</pubDate></item><item><title><![CDATA[Reply to Warum geht string str = &amp;quot;&amp;quot;; aber char t =&#x27;&#x27;; nicht ? on Tue, 13 Sep 2005 13:06:35 GMT]]></title><description><![CDATA[<p>don't feed the troll.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/871106</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/871106</guid><dc:creator><![CDATA[.........]]></dc:creator><pubDate>Tue, 13 Sep 2005 13:06:35 GMT</pubDate></item><item><title><![CDATA[Reply to Warum geht string str = &amp;quot;&amp;quot;; aber char t =&#x27;&#x27;; nicht ? on Tue, 13 Sep 2005 13:07:46 GMT]]></title><description><![CDATA[<p>Die einfachen Striche sind Anzeichen für nur ein einzelnes Zeichen. Also char und damit nur 1 Byte.<br />
Die zweifachen Striche zeigen an, dass es eine char-Array ist.</p>
<p>\0 ist nur anzeichen für Zeichenkettenende, damit zum Beispiel strcat weiß wo es den zweiten String anfügen soll.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/871108</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/871108</guid><dc:creator><![CDATA[imhotep]]></dc:creator><pubDate>Tue, 13 Sep 2005 13:07:46 GMT</pubDate></item><item><title><![CDATA[Reply to Warum geht string str = &amp;quot;&amp;quot;; aber char t =&#x27;&#x27;; nicht ? on Tue, 13 Sep 2005 13:09:09 GMT]]></title><description><![CDATA[<p>Vielen Dank für eure Antworten</p>
<pre><code>char ch = '\0';
</code></pre>
<p>habe ich gesucht.</p>
<p>Eine abschließene Frage noch. Wieso kann man den<br />
string str = &quot;&quot;; Schreiben ein String hat zwar<br />
keine 8 Bit da muesste er doch auch meckern oder ?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/871112</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/871112</guid><dc:creator><![CDATA[Habitant]]></dc:creator><pubDate>Tue, 13 Sep 2005 13:09:09 GMT</pubDate></item><item><title><![CDATA[Reply to Warum geht string str = &amp;quot;&amp;quot;; aber char t =&#x27;&#x27;; nicht ? on Tue, 13 Sep 2005 13:11:04 GMT]]></title><description><![CDATA[<p>SideWinder schrieb:</p>
<blockquote>
<p>'Nichts' gibts nicht, 2 mögliche Interpretationen sind:</p>
<pre><code class="language-cpp">// 1. Alle Bits auf 0 setzen
char ch = 0;
// bzw.
char ch = '\0';

// 2. Leerzeichen, weil das dann am Bildschirm als &quot;nichts&quot; dargestellt wird
char ch = ' ';
</code></pre>
<p>MfG SideWinder</p>
</blockquote>
<p>nee. nichts ist '\0', weil das da alle bits 0 sind und weil das auf dem bildschirm als garnix dargestellt wird. also nichtmal einen cursorvorschub erzeugt.<br />
aber weil das nicht allgemein definiert ist und weil das auch keiner weiß und weil das bei der nächsten compilerversion wieder ganz anders ist und weil das auch sehr verwirrend wäre und weil '\0' eh genau das gleiche wie '' wäre nur deutlicher, hat man eben auf '' verzichtet. außerdem wäre die fehlinterpretation bei str+=''; fatal. man könnte ja meinen, bei '' dürfe der string nicht wachsen, wenn man ohne brille hinguckt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/871115</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/871115</guid><dc:creator><![CDATA[volkard]]></dc:creator><pubDate>Tue, 13 Sep 2005 13:11:04 GMT</pubDate></item><item><title><![CDATA[Reply to Warum geht string str = &amp;quot;&amp;quot;; aber char t =&#x27;&#x27;; nicht ? on Tue, 13 Sep 2005 16:25:55 GMT]]></title><description><![CDATA[<p>Habitant schrieb:</p>
<blockquote>
<p>Eine abschließene Frage noch. Wieso kann man den<br />
string str = &quot;&quot;; Schreiben ein String hat zwar<br />
keine 8 Bit da muesste er doch auch meckern oder ?</p>
</blockquote>
<p>Nein. Ein String beschreibt eine Sequenz von Zeichen, und diese kann selbstverständlich eine Länge von 0 haben. Ein Zeichen (char, wchar_t) hingegen hat nunmal immer eine bestimmte Anzahl von Bits.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/871318</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/871318</guid><dc:creator><![CDATA[groovemaster]]></dc:creator><pubDate>Tue, 13 Sep 2005 16:25:55 GMT</pubDate></item></channel></rss>