<?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[c++ dynamisches oder statisches array?]]></title><description><![CDATA[<p>Hallo,<br />
ich habe folgenen Programmcode:</p>
<p>int len;<br />
cin &gt;&gt; len;<br />
int a[len];</p>
<p>Den Compiler stoert das nicht. Das muesste doch jetzt ein dynamisches Array sein, weil ja len beim compilieren noch nicht bekannt ist?<br />
Aber ich dachte eigentlich, dass man dynamische Arrays so zuweisen muss:</p>
<p>int *a = new int[len];</p>
<p>Oder erkennt der compiler sogar, dass len laufzeitabhaengig ist, und erzeugt dann in der dritten Zeile ein dynamisches Array, obwohl z.B. &quot;int a[10]&quot; ein statisches Array erzeugen wuerde?</p>
<p>danke fuer's Lesen</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/207764/c-dynamisches-oder-statisches-array</link><generator>RSS for Node</generator><lastBuildDate>Sun, 11 Oct 2026 07:56:06 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/207764.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 11 Mar 2008 15:05:34 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to c++ dynamisches oder statisches array? on Tue, 11 Mar 2008 15:05:34 GMT]]></title><description><![CDATA[<p>Hallo,<br />
ich habe folgenen Programmcode:</p>
<p>int len;<br />
cin &gt;&gt; len;<br />
int a[len];</p>
<p>Den Compiler stoert das nicht. Das muesste doch jetzt ein dynamisches Array sein, weil ja len beim compilieren noch nicht bekannt ist?<br />
Aber ich dachte eigentlich, dass man dynamische Arrays so zuweisen muss:</p>
<p>int *a = new int[len];</p>
<p>Oder erkennt der compiler sogar, dass len laufzeitabhaengig ist, und erzeugt dann in der dritten Zeile ein dynamisches Array, obwohl z.B. &quot;int a[10]&quot; ein statisches Array erzeugen wuerde?</p>
<p>danke fuer's Lesen</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1472168</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1472168</guid><dc:creator><![CDATA[SaebelZahnSpecht]]></dc:creator><pubDate>Tue, 11 Mar 2008 15:05:34 GMT</pubDate></item><item><title><![CDATA[Reply to c++ dynamisches oder statisches array? on Tue, 11 Mar 2008 15:20:16 GMT]]></title><description><![CDATA[<p>Das ist eigentlich ungültiger C++-Code. Kann es sein, das dein Compiler C99-Code versteht? Würde ich bei C++-Dateien abschalten.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1472193</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1472193</guid><dc:creator><![CDATA[Artchi]]></dc:creator><pubDate>Tue, 11 Mar 2008 15:20:16 GMT</pubDate></item><item><title><![CDATA[Reply to c++ dynamisches oder statisches array? on Tue, 11 Mar 2008 15:23:53 GMT]]></title><description><![CDATA[<p>Rufe deinen Compiler doch mal mit den Optionen <strong>-Wall -pedantic -pedantic-error</strong> (Standardeinstellung bei mir) auf und schon hast du Deine gewünschte Fehlermeldung.</p>
<p>Grüße... Heiko</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1472199</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1472199</guid><dc:creator><![CDATA[bwbg]]></dc:creator><pubDate>Tue, 11 Mar 2008 15:23:53 GMT</pubDate></item><item><title><![CDATA[Reply to c++ dynamisches oder statisches array? on Tue, 11 Mar 2008 15:24:20 GMT]]></title><description><![CDATA[<p>Es ist zulässig. Wieviel Platz eine Funktion auf dem Stack für lokale Variable reserviert, kann zur Laufzeit entschieden und verändert werden. Das geht sogar schon in C, z.B. hier (<a href="http://www.open-std.org/JTC1/SC22/WG14/www/docs/n1256.pdf" rel="nofollow">http://www.open-std.org/JTC1/SC22/WG14/www/docs/n1256.pdf</a>) auf S.80 (PDF-S.92).</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1472200</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1472200</guid><dc:creator><![CDATA[owkt]]></dc:creator><pubDate>Tue, 11 Mar 2008 15:24:20 GMT</pubDate></item><item><title><![CDATA[Reply to c++ dynamisches oder statisches array? on Tue, 11 Mar 2008 15:47:00 GMT]]></title><description><![CDATA[<p>Und wen interessiert C? Es geht hier um C++! Ich gehe ja auch nicht ins Java-Forum und sage &quot;Das geht sogar in C#!&quot;.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1472229</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1472229</guid><dc:creator><![CDATA[Artchi]]></dc:creator><pubDate>Tue, 11 Mar 2008 15:47:00 GMT</pubDate></item><item><title><![CDATA[Reply to c++ dynamisches oder statisches array? on Tue, 11 Mar 2008 16:00:37 GMT]]></title><description><![CDATA[<p>Es ist unzlässig und eine Erweiterung von G++.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1472245</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1472245</guid><dc:creator><![CDATA[*D*Evil]]></dc:creator><pubDate>Tue, 11 Mar 2008 16:00:37 GMT</pubDate></item><item><title><![CDATA[Reply to c++ dynamisches oder statisches array? on Wed, 12 Mar 2008 08:32:13 GMT]]></title><description><![CDATA[<p>owkt schrieb:</p>
<blockquote>
<p>Es ist zulässig. Wieviel Platz eine Funktion auf dem Stack für lokale Variable reserviert, kann zur Laufzeit entschieden und verändert werden. Das geht sogar schon in C, z.B. hier (<a href="http://www.open-std.org/JTC1/SC22/WG14/www/docs/n1256.pdf" rel="nofollow">http://www.open-std.org/JTC1/SC22/WG14/www/docs/n1256.pdf</a>) auf S.80 (PDF-S.92).</p>
</blockquote>
<p>Aber auch da erst seit dem <strong>99er</strong>-Standard .... auf dem verständlicherweises der C++-Stamdard von <strong>98</strong> nicht basiert.<br />
(Du solltest mal Deine Formulierung &quot;sogar schon in C&quot; überdenken ... anscheinend ist C++ nicht einfach nur &quot;C 1.1&quot;)</p>
<p>Gruß,</p>
<p>Simon2.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1472574</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1472574</guid><dc:creator><![CDATA[Simon2]]></dc:creator><pubDate>Wed, 12 Mar 2008 08:32:13 GMT</pubDate></item></channel></rss>