<?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[dynamische erstellung eines arrays]]></title><description><![CDATA[<p>-Text</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/128643/dynamische-erstellung-eines-arrays</link><generator>RSS for Node</generator><lastBuildDate>Tue, 25 Aug 2026 20:59:31 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/128643.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 05 Dec 2005 19:31:20 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to dynamische erstellung eines arrays on Tue, 30 Mar 2010 14:14:08 GMT]]></title><description><![CDATA[<p>-Text</p>
]]></description><link>https://www.c-plusplus.net/forum/post/935287</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/935287</guid><dc:creator><![CDATA[Aessina]]></dc:creator><pubDate>Tue, 30 Mar 2010 14:14:08 GMT</pubDate></item><item><title><![CDATA[Reply to dynamische erstellung eines arrays on Mon, 05 Dec 2005 19:40:38 GMT]]></title><description><![CDATA[<p>hallo</p>
<p>stell dein array mir new her</p>
<pre><code>int *deinarray=new int[flexiblerwert];
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/935297</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/935297</guid><dc:creator><![CDATA[elise]]></dc:creator><pubDate>Mon, 05 Dec 2005 19:40:38 GMT</pubDate></item><item><title><![CDATA[Reply to dynamische erstellung eines arrays on Tue, 30 Mar 2010 14:14:35 GMT]]></title><description><![CDATA[<p>-TEXT</p>
]]></description><link>https://www.c-plusplus.net/forum/post/935810</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/935810</guid><dc:creator><![CDATA[Aessina]]></dc:creator><pubDate>Tue, 30 Mar 2010 14:14:35 GMT</pubDate></item><item><title><![CDATA[Reply to dynamische erstellung eines arrays on Tue, 06 Dec 2005 14:53:10 GMT]]></title><description><![CDATA[<p>die frage hat elise doch schon beantwortet....</p>
<pre><code class="language-cpp">int max;
	std::cin&gt;&gt;max;
	int *arr=new int[max];
	for(int i=0;i&lt;max;++i)
	   std::cin&gt;&gt;arr[i];
</code></pre>
<p>//edit namensgebung</p>
]]></description><link>https://www.c-plusplus.net/forum/post/935831</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/935831</guid><dc:creator><![CDATA[shapeless]]></dc:creator><pubDate>Tue, 06 Dec 2005 14:53:10 GMT</pubDate></item><item><title><![CDATA[Reply to dynamische erstellung eines arrays on Tue, 06 Dec 2005 15:08:12 GMT]]></title><description><![CDATA[<p>Dann will ich mal kurz auf das wichtige Stück eingehen, denn manchmal ist es auch hilfreich zu wissen was nicht funktionierender Code macht (oder machen würde) :D:</p>
<pre><code>cout&lt;&lt;&quot;Sie wollen also &quot; &lt;&lt;werteanz ; cout&lt;&lt;&quot; Werte in die Datei &quot; &lt;&lt; dateiname ; cout&lt;&lt;&quot; schreiben&quot; &lt;&lt;endl ;
</code></pre>
<p>Warum nicht cout &lt;&lt; &quot;Text&quot; &lt;&lt; variable &lt;&lt; &quot;text&quot; &lt;&lt; ....?</p>
<pre><code>y[100] = werteanz ;
</code></pre>
<p>Hier weist Du dem 100. Element von y - welches nicht existiert da nur Elemente 0-99 vorhanden sind -&gt; Arrayüberlauf - die Anzahl der Werte zu.</p>
<pre><code>for(t=0;t&lt;=werteanz;t++)
      {
       cout&lt;&lt;&quot;Wert : &quot;  &lt;&lt; endl ;
       cin &gt;&gt; y[t] ;
      }
</code></pre>
<p>Hier liest Du in den 100stelligen Array &quot;y&quot; ein. Warum, ich dachte Du willst in das dynamische Array &quot;werteeingabe&quot; einlesen?</p>
<pre><code>werteeingabe[werteanz];
</code></pre>
<p>Du liest aus dem dynamisch generierten Array werteeingabe das Element welches eine Position hinter dem letzten Element liegt -&gt; Arrayüberlauf. Desweiteren wertest Du dieses Element nicht aus.</p>
<pre><code>for (i=0;i&lt;werteeingabe[i];i++)
         {
          schreiben &lt;&lt; werteeingabe ;
         cout &lt;&lt; werteeingabe ;
          }
</code></pre>
<p>Und nun schreibst Du die Adresse des dynamisch generierten Arrays so oft in die Datei bis i den i-ten Wert des selbigen Arrays erreicht hat. Ob das jemals passiert sei mal dahingestellt.</p>
<p>Eine letzte Sache: Das dynamisch generierte Array hat &quot;irgendeine&quot; Anzahl. Du verwendest die Variable werteanz zum ersten Mal, bevor Du ihr einen Wert zugewiesen hast.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/935860</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/935860</guid><dc:creator><![CDATA[LordJaxom]]></dc:creator><pubDate>Tue, 06 Dec 2005 15:08:12 GMT</pubDate></item><item><title><![CDATA[Reply to dynamische erstellung eines arrays on Tue, 30 Mar 2010 14:15:31 GMT]]></title><description><![CDATA[<p>-TEXT</p>
]]></description><link>https://www.c-plusplus.net/forum/post/935945</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/935945</guid><dc:creator><![CDATA[Aessina]]></dc:creator><pubDate>Tue, 30 Mar 2010 14:15:31 GMT</pubDate></item><item><title><![CDATA[Reply to dynamische erstellung eines arrays on Tue, 06 Dec 2005 16:36:11 GMT]]></title><description><![CDATA[<p>Jetzt haben es dir schon zwei Leute erklärt, elise und shapeless.<br />
Was willst du denn noch? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /></p>
<p>Aessina schrieb:</p>
<blockquote>
<p>kannste mir das vielleicht nicht anhand meiner aufgabe erklären und umsetzen?</p>
</blockquote>
<p>Irgendwie beschleicht mich das Gefühl, dass hier null Eigeninitiative vorhanden ist... <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f644.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_rolling_eyes"
      title=":rolling_eyes:"
      alt="🙄"
    /></p>
<p>Aessina schrieb:</p>
<blockquote>
<p>so lerne ich am besten und schnellsten was das mit dem dynamischen array auf sich hat</p>
</blockquote>
<p>Das mit dem &quot;schnellsten&quot; glaube ich dir, das &quot;lernen&quot; und das &quot;am besten&quot; nicht...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/935973</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/935973</guid><dc:creator><![CDATA[michba]]></dc:creator><pubDate>Tue, 06 Dec 2005 16:36:11 GMT</pubDate></item><item><title><![CDATA[Reply to dynamische erstellung eines arrays on Tue, 30 Mar 2010 14:15:56 GMT]]></title><description><![CDATA[<p>-TEXT</p>
]]></description><link>https://www.c-plusplus.net/forum/post/936060</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/936060</guid><dc:creator><![CDATA[Aessina]]></dc:creator><pubDate>Tue, 30 Mar 2010 14:15:56 GMT</pubDate></item><item><title><![CDATA[Reply to dynamische erstellung eines arrays on Tue, 06 Dec 2005 18:46:07 GMT]]></title><description><![CDATA[<p>Aessina schrieb:</p>
<blockquote>
<p>allerdings steh ich argh unter zeitdruck. muss das projekt morgen abgeben und die 2 optionen hätte ich denn dann doch noch gerne.</p>
</blockquote>
<p>Vielleicht hättest du dir das vorher überlegen müssen...</p>
<p>aber naja, ein Tip kriegst du noch:</p>
<pre><code class="language-cpp">// Nachdem werteanz eingegeben wurde:
int* werte = new int[werteanz]; // erzeugt ein Array der Größe werteanz

// Array mit Eingaben des Benutzers füllen
for(int i=0; i&lt;werteanz; ++i)
{
    cout &lt;&lt; &quot;Wert: &quot;;
    cin &gt;&gt; werte[i];
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/936088</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/936088</guid><dc:creator><![CDATA[michba]]></dc:creator><pubDate>Tue, 06 Dec 2005 18:46:07 GMT</pubDate></item></channel></rss>