<?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[dec() Funktion in Delphi ist was in C++?]]></title><description><![CDATA[<p>Hi Leute,</p>
<p>noch eine Frage: In Delphi gibt es eine dec() Funktion. Was macht die und was gibt es dazu in C++. Sie steht etwa so im Delphi code dec(y);</p>
<p>Kann mir einer dazu was sagen?</p>
<p>Danke im voraus.</p>
<p>Grüsse<br />
xthing</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/158986/dec-funktion-in-delphi-ist-was-in-c</link><generator>RSS for Node</generator><lastBuildDate>Thu, 10 Sep 2026 06:25:32 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/158986.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 11 Sep 2006 07:14:53 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to dec() Funktion in Delphi ist was in C++? on Mon, 11 Sep 2006 07:14:53 GMT]]></title><description><![CDATA[<p>Hi Leute,</p>
<p>noch eine Frage: In Delphi gibt es eine dec() Funktion. Was macht die und was gibt es dazu in C++. Sie steht etwa so im Delphi code dec(y);</p>
<p>Kann mir einer dazu was sagen?</p>
<p>Danke im voraus.</p>
<p>Grüsse<br />
xthing</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1134909</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1134909</guid><dc:creator><![CDATA[xthing]]></dc:creator><pubDate>Mon, 11 Sep 2006 07:14:53 GMT</pubDate></item><item><title><![CDATA[Reply to dec() Funktion in Delphi ist was in C++? on Mon, 11 Sep 2006 07:24:10 GMT]]></title><description><![CDATA[<p>OMG. Jetzt bin ich mir unsicher ob --y oder y--.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1134913</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1134913</guid><dc:creator><![CDATA[Apollon]]></dc:creator><pubDate>Mon, 11 Sep 2006 07:24:10 GMT</pubDate></item><item><title><![CDATA[Reply to dec() Funktion in Delphi ist was in C++? on Mon, 11 Sep 2006 08:10:42 GMT]]></title><description><![CDATA[<p>Das ist eigentlich egal, welche Version man in C++ nimmt. Die dec-Funktion ist eine Prozedur und hat somit keinen Rückgabewert. In C++ liefern beide Varianten etwas zurück.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1134944</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1134944</guid><dc:creator><![CDATA[Vellas]]></dc:creator><pubDate>Mon, 11 Sep 2006 08:10:42 GMT</pubDate></item><item><title><![CDATA[Reply to dec() Funktion in Delphi ist was in C++? on Mon, 11 Sep 2006 08:51:00 GMT]]></title><description><![CDATA[<p>Um deine Frage etwas genauer zu beantworten:</p>
<p>dec(y) dekrementiert eine Variable, also erniedrig ihren Wert um Eins.<br />
In C++ benötigt man dafür keine Funktion da es dafür zwei Operatoren gibt.<br />
In beiden Fällen wird er durch &quot;--&quot; dargestellt nur eben an einer anderen position. Wenn du die Operatoren nicht in einem Ausdruck verwendest dann machen sie auch genau das selbe :).</p>
<pre><code class="language-cpp">int y = 3;
y--;
// y enthält nun den Wert 2
--y;
// y enthält nun den Wert 1
</code></pre>
<p>Wie du siehst machen sie hier genau dasselbe.<br />
Jetzt aber in einem Ausdruck:</p>
<pre><code class="language-cpp">int x = 5;
int y = 3;
int z = 8;
int erg = 0;

erg = x + z - --y;
// erg = 11
// x = 5
// z = 8
// y = 2

y = 3 // y wieder resetten ^_^

erg = x + z - y--;
// erg = 10
// x = 5
// z = 8
// y = 2
</code></pre>
<p>Wie du siehst zwei unterschiedliche Ergebnise:<br />
Beim ersten Ausdruck wo der decrement Operator vor der Variable steht wird sie erst decrementiert und dann in den Audruck verwendet, deshalb auch erg = 11.<br />
Beim zweiten mal ist es genau andersherum, dort wird die Variable erst für den Ausdruck verwendet und dann dekrementiert, deshalb erg = 10.<br />
Hoffe hat dir einen Überblick verschaft <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>mfg tobZel</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1134979</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1134979</guid><dc:creator><![CDATA[tobZel]]></dc:creator><pubDate>Mon, 11 Sep 2006 08:51:00 GMT</pubDate></item><item><title><![CDATA[Reply to dec() Funktion in Delphi ist was in C++? on Mon, 11 Sep 2006 09:11:07 GMT]]></title><description><![CDATA[<p>Danke für Eure Antworten.</p>
<p>Grüsse<br />
xthing</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1134995</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1134995</guid><dc:creator><![CDATA[xthing]]></dc:creator><pubDate>Mon, 11 Sep 2006 09:11:07 GMT</pubDate></item></channel></rss>