<?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 enthält trotz {0} initilaisierung komische Werte]]></title><description><![CDATA[<p>Hallo,<br />
ich schreibe grade eine Art Minesweeper, aber im Moment verzweifle ich fast:</p>
<pre><code class="language-cpp">char targets[map_size][map_size] = {0};
</code></pre>
<p>In dem Array werden die Ziele mit folgendem Code mit einem x belegt:<br />
(target_count_help ist zu Beginn 10)</p>
<pre><code class="language-cpp">while(target_count_help){
x = rand()%map_size+1;
y = rand()%map_size+1;
if(!targets[x-1][y-1]){
                       targets[x-1][y-1]='x';
                       target_count_help--;
                       }
}
</code></pre>
<p>Und jetzt der Part der mich verzweifeln lässt:</p>
<pre><code class="language-cpp">cin.getline(Try, 3);
try_x = Try[1];
try_y = Try[0];
cout&lt;&lt;&quot;X: &quot;&lt;&lt;try_x&lt;&lt;&quot;  &quot;&lt;&lt;&quot;Y: &quot;&lt;&lt;try_y-'A'&lt;&lt;endl;
cout&lt;&lt;targets[try_x][try_y-'A']&lt;&lt;endl;
cout&lt;&lt;targets[9][0]&lt;&lt;endl;
</code></pre>
<p>Die eingegebene Koordinate liegt in der Form Großbuchstabe/Zahl in Try[].<br />
Wenn ich jetzt A9 eingebe, enthält die entsprechende Stelle im Array jedes mal &quot;Y&quot;! Bei anderen Werten werden plötlich Smileys ausgegeben.<br />
Wie kann das sein, wenn ich das Array anfangs mit 0 initilisiert habe?!?<br />
Wenn ich dann in der letzten Zeile direkt 9/0 ausgebe, ist das Feld wie gewünscht leer.<br />
Hoffe Ihr wisst weiter <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/topic/235698/array-enthält-trotz-0-initilaisierung-komische-werte</link><generator>RSS for Node</generator><lastBuildDate>Thu, 24 Sep 2026 03:54:02 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/235698.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 05 Mar 2009 11:30:42 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Array enthält trotz {0} initilaisierung komische Werte on Thu, 05 Mar 2009 11:30:42 GMT]]></title><description><![CDATA[<p>Hallo,<br />
ich schreibe grade eine Art Minesweeper, aber im Moment verzweifle ich fast:</p>
<pre><code class="language-cpp">char targets[map_size][map_size] = {0};
</code></pre>
<p>In dem Array werden die Ziele mit folgendem Code mit einem x belegt:<br />
(target_count_help ist zu Beginn 10)</p>
<pre><code class="language-cpp">while(target_count_help){
x = rand()%map_size+1;
y = rand()%map_size+1;
if(!targets[x-1][y-1]){
                       targets[x-1][y-1]='x';
                       target_count_help--;
                       }
}
</code></pre>
<p>Und jetzt der Part der mich verzweifeln lässt:</p>
<pre><code class="language-cpp">cin.getline(Try, 3);
try_x = Try[1];
try_y = Try[0];
cout&lt;&lt;&quot;X: &quot;&lt;&lt;try_x&lt;&lt;&quot;  &quot;&lt;&lt;&quot;Y: &quot;&lt;&lt;try_y-'A'&lt;&lt;endl;
cout&lt;&lt;targets[try_x][try_y-'A']&lt;&lt;endl;
cout&lt;&lt;targets[9][0]&lt;&lt;endl;
</code></pre>
<p>Die eingegebene Koordinate liegt in der Form Großbuchstabe/Zahl in Try[].<br />
Wenn ich jetzt A9 eingebe, enthält die entsprechende Stelle im Array jedes mal &quot;Y&quot;! Bei anderen Werten werden plötlich Smileys ausgegeben.<br />
Wie kann das sein, wenn ich das Array anfangs mit 0 initilisiert habe?!?<br />
Wenn ich dann in der letzten Zeile direkt 9/0 ausgebe, ist das Feld wie gewünscht leer.<br />
Hoffe Ihr wisst weiter <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/1674563</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1674563</guid><dc:creator><![CDATA[Webster]]></dc:creator><pubDate>Thu, 05 Mar 2009 11:30:42 GMT</pubDate></item><item><title><![CDATA[Reply to Array enthält trotz {0} initilaisierung komische Werte on Thu, 05 Mar 2009 11:54:15 GMT]]></title><description><![CDATA[<pre><code>targets[try_x]
</code></pre>
<p>try_x mag jetzt meinetwegen '5' sein... welchem Ascii-Wert entspräche das denn?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1674572</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1674572</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Thu, 05 Mar 2009 11:54:15 GMT</pubDate></item><item><title><![CDATA[Reply to Array enthält trotz {0} initilaisierung komische Werte on Thu, 05 Mar 2009 11:51:38 GMT]]></title><description><![CDATA[<p>Decimad schrieb:</p>
<blockquote>
<p>Snip</p>
</blockquote>
<p>?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1674575</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1674575</guid><dc:creator><![CDATA[Webster]]></dc:creator><pubDate>Thu, 05 Mar 2009 11:51:38 GMT</pubDate></item><item><title><![CDATA[Reply to Array enthält trotz {0} initilaisierung komische Werte on Thu, 05 Mar 2009 11:57:21 GMT]]></title><description><![CDATA[<p>Das snip bezog sich auf eine überschnellte antwort, die ich überarbeitet habe und währenddessen stand da halt Snip^^</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1674581</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1674581</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Thu, 05 Mar 2009 11:57:21 GMT</pubDate></item><item><title><![CDATA[Reply to Array enthält trotz {0} initilaisierung komische Werte on Thu, 05 Mar 2009 13:28:43 GMT]]></title><description><![CDATA[<p>Okay, ich benutze jetzt</p>
<pre><code class="language-cpp">try_x = Try[1]-'A';
</code></pre>
<p>So funktioniert es.<br />
Wer das Spiel mal ausprobieren will, hier der Source<br />
(chaotisch, weil ich zZ noch keine Funktionen benutze):</p>
<pre><code class="language-cpp">#include &lt;cstdlib&gt;
#include &lt;iostream&gt;
#include &lt;stdlib.h&gt;
#include &lt;time.h&gt;
#include &lt;conio.h&gt;
#include &lt;windows.h&gt;  

using namespace std;

void textcolor(int color)
{
	SetConsoleTextAttribute( ::GetStdHandle(STD_OUTPUT_HANDLE), color );
}

int main(int argc, char *argv[])
{
	char beep = 7;
	bool getroffen=false;
	char Try[3];
	int try_x;
	int try_y;
	bool test = false;
	const int tries = 10;
	int tries_count=tries;
	srand(time(NULL));
	const int map_size=5;
	const int target_count = 5;
	int target_count_help = target_count;
	char map[map_size][map_size] = {0};
	char targets[map_size][map_size] = {0};
	int x,y;
	char y_scale='A';
	int x_scale=1;

	cout&lt;&lt;&quot;Finden Sie einen der &quot;&lt;&lt;target_count&lt;&lt;&quot; Schaetze!&quot;&lt;&lt;endl&lt;&lt;endl;
	cout&lt;&lt;&quot;  &quot;;
	for(x_scale=0;x_scale&lt;map_size;x_scale++){
		cout&lt;&lt;x_scale&lt;&lt;' ';    
	}
	cout&lt;&lt;endl;

	for(y=0; y&lt;map_size; y++){
		cout&lt;&lt;y_scale&lt;&lt;' ';
		y_scale++;
		for(x=0;x&lt;map_size;x++){
			cout&lt;&lt;'#'&lt;&lt;' ';
		}
		cout&lt;&lt;endl;
	}
	for(y=0; y&lt;map_size; y++){
		for(x=0;x&lt;map_size;x++){
			targets[x][y]=0;
		}
	}
	while(target_count_help){
		x = rand()%map_size+1;
		y = rand()%map_size+1;
		if(!targets[x-1][y-1]){
			targets[x-1][y-1]='x';
			target_count_help--;
		}
	}                                          
	if(test){                        
		for(y=0; y&lt;map_size; y++)         {
			cout&lt;&lt;&quot;  &quot;;
			for(x=0;x&lt;map_size;x++){
				cout&lt;&lt;targets[x][y]&lt;&lt;' ';
			}
			cout&lt;&lt;endl;
		}                  
	}              
	cout&lt;&lt;&quot;\r\nZiel eingeben:&quot;&lt;&lt;endl;
	while(tries_count&gt;0 &amp;&amp; !getroffen){
		cin.getline(Try, 3);
		try_x = Try[1]-'0';
		try_y = Try[0]-'A';
		//cout&lt;&lt;&quot;X: &quot;&lt;&lt;try_x&lt;&lt;&quot;  &quot;&lt;&lt;&quot;Y: &quot;&lt;&lt;try_y&lt;&lt;endl;
		if(targets[try_x][try_y] == 'x'){
			cout&lt;&lt;&quot;\r\nGewonnen!&quot;&lt;&lt;endl&lt;&lt;&quot;Sie haben einen Schatz gefunden!\r\n&quot;&lt;&lt;endl;
			getroffen = true;    

			for(y=0; y&lt;map_size; y++){
				cout&lt;&lt;&quot;  &quot;;
				for(x=0;x&lt;map_size;x++){

					if(x != try_x || y != try_y){
						cout&lt;&lt;targets[x][y]&lt;&lt;' ';
					}else{
						textcolor(12);
						cout&lt;&lt;'#';
						textcolor(15);
					}
				}
				cout&lt;&lt;endl;
			}                  
			cout&lt;&lt;endl;                        
		}        

		else{
			cout&lt;&lt;&quot;keinen Schatz gefunden...&quot;&lt;&lt;endl;
		}
		tries_count--;    
		if(tries_count &amp;&amp; !getroffen) cout&lt;&lt;&quot;Noch &quot;&lt;&lt;tries_count&lt;&lt;&quot; Versuche.&quot;&lt;&lt;endl;
	}
	if(!getroffen) cout&lt;&lt;&quot;Verloren!&quot;&lt;&lt;beep&lt;&lt;endl&lt;&lt;endl;
	system(&quot;PAUSE&quot;);
	return EXIT_SUCCESS;
}
</code></pre>
<p>//Edit: Code _etwas_ lesbarer formatiert</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1674604</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1674604</guid><dc:creator><![CDATA[Webster]]></dc:creator><pubDate>Thu, 05 Mar 2009 13:28:43 GMT</pubDate></item><item><title><![CDATA[Reply to Array enthält trotz {0} initilaisierung komische Werte on Thu, 05 Mar 2009 16:38:59 GMT]]></title><description><![CDATA[<p>Webster schrieb:</p>
<blockquote>
<p>(chaotisch, weil ich zZ noch keine Funktionen benutze)</p>
</blockquote>
<p>Ahja... aber die Formatierung soll in Ordnung sein?! *scnr</p>
<p>EDIT: Jetzt hat er es schon um einiges besser formatiert. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1674621</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1674621</guid><dc:creator><![CDATA[lagalopex]]></dc:creator><pubDate>Thu, 05 Mar 2009 16:38:59 GMT</pubDate></item><item><title><![CDATA[Reply to Array enthält trotz {0} initilaisierung komische Werte on Thu, 05 Mar 2009 13:23:57 GMT]]></title><description><![CDATA[<p>lagalopex schrieb:</p>
<blockquote>
<p>Webster schrieb:</p>
<blockquote>
<p>(chaotisch, weil ich zZ noch keine Funktionen benutze)</p>
</blockquote>
<p>Ahja... aber die Formatierung soll in Ordnung sein?! *scnr</p>
</blockquote>
<p>Ist sie nicht. Ich komm mit devcpp nicht ganz klar...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1674632</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1674632</guid><dc:creator><![CDATA[Webster]]></dc:creator><pubDate>Thu, 05 Mar 2009 13:23:57 GMT</pubDate></item><item><title><![CDATA[Reply to Array enthält trotz {0} initilaisierung komische Werte on Thu, 05 Mar 2009 16:28:36 GMT]]></title><description><![CDATA[<p>ich greif mir mal grade ne stelle wo mans besonders drastisch sieht:</p>
<pre><code class="language-cpp">for(y=0; y&lt;map_size; y++){
                cout&lt;&lt;&quot;  &quot;;
                for(x=0;x&lt;map_size;x++){

                    if(x != try_x || y != try_y){
                        cout&lt;&lt;targets[x][y]&lt;&lt;' ';
                    }else{
                        textcolor(12);
                        cout&lt;&lt;'#';
                        textcolor(15);
                    }
                }
                cout&lt;&lt;endl;
            }
</code></pre>
<p>die '{' gehört nicht hinter die schleife/bedingung! mag zwar<br />
geschmackssache sein, aber man kanns echt schwer lesen besonders bei<br />
bis zu 4 einrückebenen wo welche klammer hingehört.</p>
<p>versuchs so</p>
<pre><code class="language-cpp">for(y = 0; y &lt; map_size; ++y)
{
    cout &lt;&lt; &quot;  &quot;;
    for(x = 0; x &lt; map_size; ++x)
    {
        if(x != try_x || y != try_y)
        {
            cout &lt;&lt; targets[x][y] &lt;&lt; ' ';
        }
        else
        {
            textcolor(12);
            cout &lt;&lt; '#';
            textcolor(15);
        }
    }
    cout &lt;&lt; endl;
}
</code></pre>
<p><img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1674736</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1674736</guid><dc:creator><![CDATA[einrücker]]></dc:creator><pubDate>Thu, 05 Mar 2009 16:28:36 GMT</pubDate></item><item><title><![CDATA[Reply to Array enthält trotz {0} initilaisierung komische Werte on Thu, 05 Mar 2009 16:31:24 GMT]]></title><description><![CDATA[<p>einrücker schrieb:</p>
<blockquote>
<p>ich greif mir mal grade ne stelle wo mans besonders drastisch sieht:</p>
</blockquote>
<p>Sehe da kein Problem.<br />
Du musst die Klammer nicht sehen - die Einrueckung sagt dir schon wo ein Block beginnt und wo er endet...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1674737</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1674737</guid><dc:creator><![CDATA[Shade Of Mine]]></dc:creator><pubDate>Thu, 05 Mar 2009 16:31:24 GMT</pubDate></item><item><title><![CDATA[Reply to Array enthält trotz {0} initilaisierung komische Werte on Thu, 05 Mar 2009 16:48:55 GMT]]></title><description><![CDATA[<p>Sehe das ähnlich wie Shade of Mine.<br />
Nebenbei bemerkt wird der Einrückungsstil, den Webster verwendet u.a. im Linuxkernel eingesetzt.<br />
Das lässt wohl darauf schließen dass eine ganze Reihe guter Programmierer diesen Stil als sinnvoll und gut zu lesen anerkannt haben, was zwar nicht bedeutet, man muss ihn unbedingt mögen, jedoch zumindest nahelegt, dass der Stil nicht unbedingt schlecht ist. Absolute Geschmackssache und deswegen wohl kaum eine Diskussion wert.</p>
<p>Ich finde hingegen, dass einige Leerzeilen mehr dem Code gutun würde, v.a. zwischen mehreren Funktionen und Variablen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1674744</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1674744</guid><dc:creator><![CDATA[Wongo]]></dc:creator><pubDate>Thu, 05 Mar 2009 16:48:55 GMT</pubDate></item><item><title><![CDATA[Reply to Array enthält trotz {0} initilaisierung komische Werte on Thu, 05 Mar 2009 18:18:22 GMT]]></title><description><![CDATA[<p>Hmm. Also ich bin da anderer Meinung. Ich lese Blockweise schneller und übersehe weniger. Wie ist das denn bei euch? - Wenn ihr viel (unbekannten) Code habt, wo ihr was drin machen müsst, akzeptiert ihr den Stil einfach und kommt gut damit klar, oder wäre es euch doch lieber der andere?</p>
<p>Lesen kann ichs auch, aber ich übersehe da eher etwas, als wenn ich die Blockweise nehme.</p>
<p>Ich will jetzt keine Diskussion, was besser ist. Das ist bestimmt ansichtssache, aber nehmt ihr den Stil einfach, weil er halt Standard ist und weit verbreitet, oder weil ihrs <strong>wirklich</strong> besser und schneller lesen könnt?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1674795</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1674795</guid><dc:creator><![CDATA[drakon]]></dc:creator><pubDate>Thu, 05 Mar 2009 18:18:22 GMT</pubDate></item><item><title><![CDATA[Reply to Array enthält trotz {0} initilaisierung komische Werte on Thu, 05 Mar 2009 19:41:04 GMT]]></title><description><![CDATA[<p>keiner der beiden Stile ist standard - oder beide. Je nachdem wie mans nimmt: Codestil ist was Klammersetzung usw. angeht nicht standardisiert, auch nicht quasi-standardisiert. Auf der anderen Seite kommen beide Stile häufig vor, es ist Geschmackssache welchen man theoretisch besser findet, Gewöhnungssache mit welchem man praktisch besser zurechtkommt und Projektsache welchen man dann tatsächlich praktiziert.</p>
<p>Wenn man viel unbekannten Code hat bleibt einem nichts anderes übrig als den vorliegenden Stil zu akzeptieren, und wenn man ihn bearbeiten muss sogar im gleichen Stil weiterzuschreiben.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1674858</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1674858</guid><dc:creator><![CDATA[pumuckl]]></dc:creator><pubDate>Thu, 05 Mar 2009 19:41:04 GMT</pubDate></item><item><title><![CDATA[Reply to Array enthält trotz {0} initilaisierung komische Werte on Thu, 05 Mar 2009 21:21:11 GMT]]></title><description><![CDATA[<p>irgendwie hab ich das gefühl dasss heir am thema vorbei geredet wird oder?</p>
<p>aber zum thema<br />
soweit ich weis kann man ein array nicht auf deine weise initialisieren oder?</p>
<p>sowas geht</p>
<pre><code class="language-cpp">int [] a = { 0, 1, 2, 3, 4 };
int [5] b = { 0, 1, 2, 3, 4 };

int [5] falsch = { 0 }; //  geht nicht
</code></pre>
<p>d.h. es geht schon nur ist nur der erste wert mit 0 belegt (oder halt die ersten 10 wenn du 10 zahlen reinschreibst</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1674923</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1674923</guid><dc:creator><![CDATA[Skym0sh0]]></dc:creator><pubDate>Thu, 05 Mar 2009 21:21:11 GMT</pubDate></item><item><title><![CDATA[Reply to Array enthält trotz {0} initilaisierung komische Werte on Thu, 05 Mar 2009 21:38:57 GMT]]></title><description><![CDATA[<p>Wenn du ein schon intialisiertes Array brauchst, nim doch gleich std::vector.<br />
da kanste dann auch gleich beim konstruktor den Standardwert übergeben. Bsp.:</p>
<pre><code class="language-cpp">std::vector&lt;char&gt; DeinArray(5,'A')
</code></pre>
<p>So hast du einen Vector mit 5 Elementen, die bereits mit einem A initialisiert sind.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1674946</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1674946</guid><dc:creator><![CDATA[Gate]]></dc:creator><pubDate>Thu, 05 Mar 2009 21:38:57 GMT</pubDate></item><item><title><![CDATA[Reply to Array enthält trotz {0} initilaisierung komische Werte on Thu, 05 Mar 2009 21:59:48 GMT]]></title><description><![CDATA[<p>Skym0sh0 schrieb:</p>
<blockquote>
<p>d.h. es geht schon nur ist nur der erste wert mit 0 belegt (oder halt die ersten 10 wenn du 10 zahlen reinschreibst</p>
</blockquote>
<p>Nein eine Null reich um alles mit 0 zu initialisieren.</p>
<p>ISO IEC 14882 §8.5.1,7 schrieb:</p>
<blockquote>
<p>If there are fewer initializers in the list than there are members in the aggregate, then each member not<br />
explicitly initialized shall be value-initialized (8.5)</p>
</blockquote>
<p>ISO IEC 14882 §8.5,5 schrieb:</p>
<blockquote>
<p>To value-initialize an object of type T means:<br />
— if T is a class type (clause 9) with a user-declared constructor (12.1), then the default constructor for T is<br />
called (and the initialization is ill-formed if T has no accessible default constructor);<br />
— if T is a non-union class type without a user-declared constructor, then every non-static data member<br />
and base-class component of T is value-initialized;<br />
- if T is an array type, then each element is value-initialized;<br />
— otherwise, the object is zero-initialized</p>
</blockquote>
]]></description><link>https://www.c-plusplus.net/forum/post/1674962</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1674962</guid><dc:creator><![CDATA[pumuckl]]></dc:creator><pubDate>Thu, 05 Mar 2009 21:59:48 GMT</pubDate></item><item><title><![CDATA[Reply to Array enthält trotz {0} initilaisierung komische Werte on Thu, 05 Mar 2009 22:30:37 GMT]]></title><description><![CDATA[<p>Wenn ihr mal wieder so hässlichen Code habt ( '{' neben Funktionsname) könnt ihr doch einfach replacen:</p>
<p>Find what:<br />
\) \{</p>
<p>Replace with:<br />
)\n{</p>
<p>Use: Regular Expressions</p>
<p><img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f44d.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--thumbs_up"
      title=":+1:"
      alt="👍"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1674975</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1674975</guid><dc:creator><![CDATA[Replac0r]]></dc:creator><pubDate>Thu, 05 Mar 2009 22:30:37 GMT</pubDate></item><item><title><![CDATA[Reply to Array enthält trotz {0} initilaisierung komische Werte on Fri, 06 Mar 2009 13:14:20 GMT]]></title><description><![CDATA[<p>Skym0sh0 schrieb:</p>
<blockquote>
<p>sowas geht</p>
<pre><code class="language-cpp">int [] a = { 0, 1, 2, 3, 4 };
int [5] b = { 0, 1, 2, 3, 4 };

int [5] falsch = { 0 }; //  geht nicht
</code></pre>
</blockquote>
<p>Die Dimensionsklammern kommen aber nach dem Bezeichner. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /><br />
Es reicht übrigens auch Folgendes, um das ganze Array mit 0 zu initialisieren:</p>
<pre><code class="language-cpp">int richtig[5] = {};
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1675239</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1675239</guid><dc:creator><![CDATA[Nexus]]></dc:creator><pubDate>Fri, 06 Mar 2009 13:14:20 GMT</pubDate></item></channel></rss>