<?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[Dynamisches Array]]></title><description><![CDATA[<p>Hallo,<br />
ich habe eine Klasse, in der ein Array bestimmer Größe erstellt werden soll.<br />
Dann greifen einige Prozeduren darauf zu.</p>
<p>Ich habe mir folgendes überlegt:</p>
<pre><code class="language-cpp">class Graph {
    private:
         [...]
         long  *lValues;
    public:
         [...]
};

inline Graph::Graph(HWND WindowHandle, int Top, long Max, int ValueSpace) {
	[...]
	//Array erstellen und alle Werte auf 0 setzen
	lValues = new long [iValuesMaxIndex];

	for (int i = 0; i &lt;= iValuesMaxIndex; i++) {
		lValues[i] = 0;
	}
}
</code></pre>
<p>Das Problem ist, dass das Array völlig andere Werte als 0 enthält, wenn ich sie von anderen Prozeduren innerhalb der Klasse abfrage..</p>
<p>Was mache ich falsch bzw. wie bekomme ich ein dynamisches Array in c++?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/196338/dynamisches-array</link><generator>RSS for Node</generator><lastBuildDate>Wed, 30 Sep 2026 10:07:18 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/196338.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 28 Oct 2007 15:04:43 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Dynamisches Array on Sun, 28 Oct 2007 15:04:43 GMT]]></title><description><![CDATA[<p>Hallo,<br />
ich habe eine Klasse, in der ein Array bestimmer Größe erstellt werden soll.<br />
Dann greifen einige Prozeduren darauf zu.</p>
<p>Ich habe mir folgendes überlegt:</p>
<pre><code class="language-cpp">class Graph {
    private:
         [...]
         long  *lValues;
    public:
         [...]
};

inline Graph::Graph(HWND WindowHandle, int Top, long Max, int ValueSpace) {
	[...]
	//Array erstellen und alle Werte auf 0 setzen
	lValues = new long [iValuesMaxIndex];

	for (int i = 0; i &lt;= iValuesMaxIndex; i++) {
		lValues[i] = 0;
	}
}
</code></pre>
<p>Das Problem ist, dass das Array völlig andere Werte als 0 enthält, wenn ich sie von anderen Prozeduren innerhalb der Klasse abfrage..</p>
<p>Was mache ich falsch bzw. wie bekomme ich ein dynamisches Array in c++?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1393625</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1393625</guid><dc:creator><![CDATA[ripmav]]></dc:creator><pubDate>Sun, 28 Oct 2007 15:04:43 GMT</pubDate></item><item><title><![CDATA[Reply to Dynamisches Array on Sun, 28 Oct 2007 15:12:24 GMT]]></title><description><![CDATA[<p>Dynamisches Array: std::vector aus dem Header &lt;vector&gt;.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1393628</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1393628</guid><dc:creator><![CDATA[Konrad Rudolph]]></dc:creator><pubDate>Sun, 28 Oct 2007 15:12:24 GMT</pubDate></item><item><title><![CDATA[Reply to Dynamisches Array on Sun, 28 Oct 2007 16:17:30 GMT]]></title><description><![CDATA[<p>Danke!<br />
Darauf bin ich gar nicht gekommen <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>
]]></description><link>https://www.c-plusplus.net/forum/post/1393669</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1393669</guid><dc:creator><![CDATA[ripmav]]></dc:creator><pubDate>Sun, 28 Oct 2007 16:17:30 GMT</pubDate></item></channel></rss>