<?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[Array mit for Schleife: falsche Ausgabe]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich versuche gerade ein Array mit Zahlen zu füllen. Das ganze soll über eine For- Schleife laufen.</p>
<p>Code lässt sich ausführen, aber es kommt ein komisches Ergebnis. Bei folgendem Code...:</p>
<pre><code>#include &lt;iostream&gt;
#include &lt;cstdlib&gt;

using namespace std;

int main(int argc, char *argv[]) {

const int size = 3;
int arrgh[size];

for (int i = 0; i &lt; size; i++) {
   cout &lt;&lt; arrgh[size];
}

		return 0;
}
</code></pre>
<p>... kommen bei mir einfach 3 Nullen raus.</p>
<p>Das ergibt irgendwie nicht groß Sinn. Hab erst gedacht, dass ich in der Ausgabe einen Fehler gemacht habe und habe das arrgh[size] mit arrgh[i] ersetzt, aber dann kommt das raus: 420004002....usw.. ergibt noch viel weniger Sinn.</p>
<p>Vielleicht habt ihr eine Idee was das für ein Fehler ist, oder ob der Code einfach falsch ist. Ich find den Code jedenfalls logisch <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
<p>Gruß<br />
Jeez</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/317660/array-mit-for-schleife-falsche-ausgabe</link><generator>RSS for Node</generator><lastBuildDate>Tue, 28 Jul 2026 22:04:01 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/317660.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 16 Jun 2013 17:41:37 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Array mit for Schleife: falsche Ausgabe on Sun, 16 Jun 2013 17:41:37 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich versuche gerade ein Array mit Zahlen zu füllen. Das ganze soll über eine For- Schleife laufen.</p>
<p>Code lässt sich ausführen, aber es kommt ein komisches Ergebnis. Bei folgendem Code...:</p>
<pre><code>#include &lt;iostream&gt;
#include &lt;cstdlib&gt;

using namespace std;

int main(int argc, char *argv[]) {

const int size = 3;
int arrgh[size];

for (int i = 0; i &lt; size; i++) {
   cout &lt;&lt; arrgh[size];
}

		return 0;
}
</code></pre>
<p>... kommen bei mir einfach 3 Nullen raus.</p>
<p>Das ergibt irgendwie nicht groß Sinn. Hab erst gedacht, dass ich in der Ausgabe einen Fehler gemacht habe und habe das arrgh[size] mit arrgh[i] ersetzt, aber dann kommt das raus: 420004002....usw.. ergibt noch viel weniger Sinn.</p>
<p>Vielleicht habt ihr eine Idee was das für ein Fehler ist, oder ob der Code einfach falsch ist. Ich find den Code jedenfalls logisch <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
<p>Gruß<br />
Jeez</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2331578</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2331578</guid><dc:creator><![CDATA[Jeez]]></dc:creator><pubDate>Sun, 16 Jun 2013 17:41:37 GMT</pubDate></item><item><title><![CDATA[Reply to Array mit for Schleife: falsche Ausgabe on Sun, 16 Jun 2013 18:01:43 GMT]]></title><description><![CDATA[<p>Welche Werte besitzt das Array in Zeile 10?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2331583</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2331583</guid><dc:creator><![CDATA[Nathan]]></dc:creator><pubDate>Sun, 16 Jun 2013 18:01:43 GMT</pubDate></item><item><title><![CDATA[Reply to Array mit for Schleife: falsche Ausgabe on Sun, 16 Jun 2013 18:01:44 GMT]]></title><description><![CDATA[<p>Was würdest du denn erwarten?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2331584</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2331584</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Sun, 16 Jun 2013 18:01:44 GMT</pubDate></item><item><title><![CDATA[Reply to Array mit for Schleife: falsche Ausgabe on Sun, 16 Jun 2013 19:17:43 GMT]]></title><description><![CDATA[<p>Jeez schrieb:</p>
<blockquote>
<p>Ich find den Code jedenfalls logisch <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
</blockquote>
<p>Die Logik solltest du mal erklären.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2331602</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2331602</guid><dc:creator><![CDATA[manni66]]></dc:creator><pubDate>Sun, 16 Jun 2013 19:17:43 GMT</pubDate></item><item><title><![CDATA[Reply to Array mit for Schleife: falsche Ausgabe on Sun, 16 Jun 2013 20:16:58 GMT]]></title><description><![CDATA[<p>manni66 schrieb:</p>
<blockquote>
<p>Die Logik solltest du mal erklären.</p>
</blockquote>
<p>Also:</p>
<p>Die const &quot;size&quot; soll die Länge des Array darstellen, also wieviele Indizes es gibt.<br />
Dann initialisiere ich das Array und beziehe dann die Länge des Arrays aus size.<br />
Sollte ja so richtig sein.</p>
<p>Dann sage ich er soll das Array einmal durchlaufen, wobei er beim letzten Index, hier der 3, aufhört. Also bei Index 0 eine 1 reinschreibt, bei Index 1 eine 2, usw.</p>
<p>Und dann soll er das Array ausgeben, wobei i das Array ja gefüllt hat.</p>
<p>SeppJ schrieb:</p>
<blockquote>
<p>Was würdest du denn erwarten?</p>
</blockquote>
<p>Dass die Werte 1,2,3 ausgegeben werden.</p>
<p>Nathan schrieb:</p>
<blockquote>
<p>Welche Werte besitzt das Array in Zeile 10?</p>
</blockquote>
<p>mhh...gute Frage. Eigentlich ja gar keine. i hat da noch nix mit dem Array zu tun...</p>
<p>Gut...ich probier mal weiter...danke schonmal für die Bemerkungen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2331617</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2331617</guid><dc:creator><![CDATA[Jeez]]></dc:creator><pubDate>Sun, 16 Jun 2013 20:16:58 GMT</pubDate></item><item><title><![CDATA[Reply to Array mit for Schleife: falsche Ausgabe on Sun, 16 Jun 2013 20:27:20 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>du musst auch erst einmal die Werte in das Array eintragen, damit er auch von 1 - 3 zählen kann:</p>
<pre><code>#include &lt;iostream&gt;
#include &lt;cstdlib&gt;

using namespace std;

int main(int argc, char *argv[])
{
	const int size = 3;
	int arrgh[size];

	for(int i = 0; i &lt; size; i++)
	{
		arrgh[i] = i + 1;
		cout &lt;&lt; arrgh[i] &lt;&lt; &quot;\n&quot;;
	}

	return 0;
}
</code></pre>
<p>Liebe Grüße</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2331618</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2331618</guid><dc:creator><![CDATA[fritzi2013]]></dc:creator><pubDate>Sun, 16 Jun 2013 20:27:20 GMT</pubDate></item><item><title><![CDATA[Reply to Array mit for Schleife: falsche Ausgabe on Sun, 16 Jun 2013 20:54:02 GMT]]></title><description><![CDATA[<p>Jeez schrieb:</p>
<blockquote>
<p>Dann sage ich er soll das Array einmal durchlaufen, wobei er beim letzten Index, hier der 3, aufhört. Also bei Index 0 eine 1 reinschreibt, bei Index 1 eine 2, usw.</p>
</blockquote>
<p>Welche Zeile(n) in deinem Programm sollen das tun?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2331621</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2331621</guid><dc:creator><![CDATA[manni66]]></dc:creator><pubDate>Sun, 16 Jun 2013 20:54:02 GMT</pubDate></item><item><title><![CDATA[Reply to Array mit for Schleife: falsche Ausgabe on Wed, 11 Jun 2014 23:23:14 GMT]]></title><description><![CDATA[<p>...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2331672</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2331672</guid><dc:creator><![CDATA[Swordfish]]></dc:creator><pubDate>Wed, 11 Jun 2014 23:23:14 GMT</pubDate></item></channel></rss>