<?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[Konstante Wert zuweisen]]></title><description><![CDATA[<p>Hi,</p>
<p>ich benötige einen Stringarray dessen größe über eine Konstante bestimmt wird.</p>
<pre><code>int const gr = 200;
String myArray[gr];
</code></pre>
<p>Funktioniert problemlos.</p>
<p>Laut <a href="http://tutorial.schornboeck.net/konstanten.htm" rel="nofollow">http://tutorial.schornboeck.net/konstanten.htm</a> geht es auch so:</p>
<pre><code>int t;
      cin&gt;&gt;t;
      int const Konstante=t;
</code></pre>
<p>Dann meckert aber der Kompiler, dass für den Array ein Konstantenausdruck benötigt wird.<br />
Deke ich hier um zu viele Ecken rum oder ist da ein Fehler drin?</p>
<p>mfg<br />
Rai</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/159952/konstante-wert-zuweisen</link><generator>RSS for Node</generator><lastBuildDate>Tue, 11 Aug 2026 03:38:55 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/159952.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 20 Sep 2006 12:27:32 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Konstante Wert zuweisen on Wed, 20 Sep 2006 12:27:32 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>ich benötige einen Stringarray dessen größe über eine Konstante bestimmt wird.</p>
<pre><code>int const gr = 200;
String myArray[gr];
</code></pre>
<p>Funktioniert problemlos.</p>
<p>Laut <a href="http://tutorial.schornboeck.net/konstanten.htm" rel="nofollow">http://tutorial.schornboeck.net/konstanten.htm</a> geht es auch so:</p>
<pre><code>int t;
      cin&gt;&gt;t;
      int const Konstante=t;
</code></pre>
<p>Dann meckert aber der Kompiler, dass für den Array ein Konstantenausdruck benötigt wird.<br />
Deke ich hier um zu viele Ecken rum oder ist da ein Fehler drin?</p>
<p>mfg<br />
Rai</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1141107</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1141107</guid><dc:creator><![CDATA[raimond]]></dc:creator><pubDate>Wed, 20 Sep 2006 12:27:32 GMT</pubDate></item><item><title><![CDATA[Reply to Konstante Wert zuweisen on Wed, 20 Sep 2006 12:47:01 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>dann lies nochmal den letzten Absatz über den Unterschied zwischen Compiletime-Konstanten und Runtime-Konstanten.<br />
Das was du vorhast, geht in C++ nicht. Dazu brauchst du ein dynamisches Array. Entweder legst du sleber eins mit new an (und löscht es selber wieder), oder du verwendest dynamsiche Arrays wie <em>DynamicArray</em> oder <em>std::vector</em>.</p>
<p>bis bald<br />
akari</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1141123</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1141123</guid><dc:creator><![CDATA[akari]]></dc:creator><pubDate>Wed, 20 Sep 2006 12:47:01 GMT</pubDate></item></channel></rss>