<?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[While Argumente nicht verstanden]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich bin nun in meinem Tutorial schon etwas weiter, verstehe aber das Argument dieser While Schleife nicht richtig :</p>
<pre><code class="language-cpp">void eatspaces(char *str)
	{
		int i = 0; // ‘Copy to’ index to string
		int j = 0; // ‘Copy from’ index to string

		while((*(str + i) = *(str + j++)) != '\0') // Loop while character is not \0
			if(*(str + i) != ' ') // Increment i as long as
				i++; // character is not a space
		return;			
	}
</code></pre>
<p>Diese funktion soll alle Leerzeichen in einem Übergebenen String ( char *str ) entfernen. Tut sie auch ,aber ich versteh die while schleife nicht wirklich.<br />
Kann mir das mal jemand näher erklären, vielleicht mal die schlefe auseinandernehmen ?</p>
<p>Hierrum gehts also genau : while((*(str + i) = *(str + j++)) != '\0')<br />
Was ganz genau mach das ?</p>
<p>Danke<br />
Matthias</p>
<p>übrigens hatte ich hier :<br />
<a href="http://www.c-plusplus.net/forum/viewtopic-var-t-is-160549-and-highlight-is-.html" rel="nofollow">http://www.c-plusplus.net/forum/viewtopic-var-t-is-160549-and-highlight-is-.html</a><br />
auch noch ne Frage, aber anscheinend ist das forum dort nicht wirklich das richtige für diese Frage</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/160564/while-argumente-nicht-verstanden</link><generator>RSS for Node</generator><lastBuildDate>Fri, 11 Sep 2026 07:27:30 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/160564.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 26 Sep 2006 23:38:53 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to While Argumente nicht verstanden on Tue, 26 Sep 2006 23:38:53 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich bin nun in meinem Tutorial schon etwas weiter, verstehe aber das Argument dieser While Schleife nicht richtig :</p>
<pre><code class="language-cpp">void eatspaces(char *str)
	{
		int i = 0; // ‘Copy to’ index to string
		int j = 0; // ‘Copy from’ index to string

		while((*(str + i) = *(str + j++)) != '\0') // Loop while character is not \0
			if(*(str + i) != ' ') // Increment i as long as
				i++; // character is not a space
		return;			
	}
</code></pre>
<p>Diese funktion soll alle Leerzeichen in einem Übergebenen String ( char *str ) entfernen. Tut sie auch ,aber ich versteh die while schleife nicht wirklich.<br />
Kann mir das mal jemand näher erklären, vielleicht mal die schlefe auseinandernehmen ?</p>
<p>Hierrum gehts also genau : while((*(str + i) = *(str + j++)) != '\0')<br />
Was ganz genau mach das ?</p>
<p>Danke<br />
Matthias</p>
<p>übrigens hatte ich hier :<br />
<a href="http://www.c-plusplus.net/forum/viewtopic-var-t-is-160549-and-highlight-is-.html" rel="nofollow">http://www.c-plusplus.net/forum/viewtopic-var-t-is-160549-and-highlight-is-.html</a><br />
auch noch ne Frage, aber anscheinend ist das forum dort nicht wirklich das richtige für diese Frage</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1145180</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1145180</guid><dc:creator><![CDATA[STF-DIR]]></dc:creator><pubDate>Tue, 26 Sep 2006 23:38:53 GMT</pubDate></item><item><title><![CDATA[Reply to While Argumente nicht verstanden on Wed, 27 Sep 2006 05:28:17 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">while((*(str + i) = *(str + j++)) != '\0')
</code></pre>
<p>Die Abarbeitung sieht wie folgt aus:<br />
1. &quot;(str+j)&quot; wird errechnet; es wird somit das &quot;j.te&quot; Zeichen von &quot;str&quot; addressiert<br />
2. &quot;*(str+j)&quot; bedeutet, dass nicht die Adresse genommen wird, sondern der Inhalt der Adresse (also das Zeichen)<br />
4. Jetzt wird &quot;(str+i)&quot; ausgewertet (i.te Zeichen in str)<br />
5. und dann das Ergebnis des obigen Zeichens (also *(str+j)&quot; in den Inhalt von *(str+i) geschrieben (zugeweisen)<br />
3. Dieses Zeichen wird jetzt mit != '\0' verglichen, welches man aber auch mit &quot;!= 0&quot; hätte schreiben können und entsprechend die &quot;while&quot; Schleife ausgeführt oder nicht</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1145200</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1145200</guid><dc:creator><![CDATA[Jochen Kalmbach]]></dc:creator><pubDate>Wed, 27 Sep 2006 05:28:17 GMT</pubDate></item><item><title><![CDATA[Reply to While Argumente nicht verstanden on Wed, 27 Sep 2006 05:28:36 GMT]]></title><description><![CDATA[<p>Dieser Thread wurde von Moderator/in <a href="http://www.c-plusplus.net/forum/profile.php?mode=viewprofile&amp;u=18363" rel="nofollow">Jochen Kalmbach</a> aus dem Forum <a href="http://www.c-plusplus.net/forum/viewforum.php?f=58" rel="nofollow">C++/CLI mit .NET</a> in das Forum <a href="http://www.c-plusplus.net/forum/viewforum.php?f=15" rel="nofollow">C++</a> verschoben.</p>
<p>Im Zweifelsfall bitte auch folgende Hinweise beachten:<br />
<a href="http://www.c-plusplus.net/forum/viewtopic.php?t=39405" rel="nofollow">C/C++ Forum :: FAQ - Sonstiges :: Wohin mit meiner Frage?</a></p>
<p><em>Dieses Posting wurde automatisch erzeugt.</em></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1145201</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1145201</guid><dc:creator><![CDATA[C++ Forumbot]]></dc:creator><pubDate>Wed, 27 Sep 2006 05:28:36 GMT</pubDate></item><item><title><![CDATA[Reply to While Argumente nicht verstanden on Wed, 27 Sep 2006 07:15:26 GMT]]></title><description><![CDATA[<p>stichwort <a href="http://de.wikipedia.org/wiki/Boolesche_Algebra" rel="nofollow">boolesche algebra</a>.</p>
<p>etwas umformuliert:</p>
<pre><code>bool bedingung= true;
while(bedingung)
{
  str[i]= str[j++];
  if (str[i]==0)
    bedingung= false;
  else if(str[i]!=' ') i++;
};
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1145237</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1145237</guid><dc:creator><![CDATA[hellihjb]]></dc:creator><pubDate>Wed, 27 Sep 2006 07:15:26 GMT</pubDate></item><item><title><![CDATA[Reply to While Argumente nicht verstanden on Wed, 27 Sep 2006 14:22:16 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>dank Euchfür dn.<br />
Ich hatte dieses *(str + j++) nicht verstanden.<br />
j ist am anfang doch 0. bei dem ersten aufruf des while arguments ist doch j auch noch 0 weil j++ besagt das j erst nach dem gebrauch um 1 erhöht wird ja ?</p>
<p>Ist das so richtig ?</p>
<p>Matthias</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1145455</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1145455</guid><dc:creator><![CDATA[STF-DIR]]></dc:creator><pubDate>Wed, 27 Sep 2006 14:22:16 GMT</pubDate></item></channel></rss>