<?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[String]]></title><description><![CDATA[<p>Hallo,</p>
<pre><code class="language-cpp">char arr[3][6]
</code></pre>
<p>ich habe 3 strings mit jeweils der Länge 6 angelegt.</p>
<p>Wieso geht das nicht.</p>
<pre><code class="language-cpp">arr[1]=&quot;Hallo&quot;;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/290972/string</link><generator>RSS for Node</generator><lastBuildDate>Mon, 17 Aug 2026 15:53:58 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/290972.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 08 Aug 2011 07:46:41 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to String on Mon, 08 Aug 2011 07:46:41 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<pre><code class="language-cpp">char arr[3][6]
</code></pre>
<p>ich habe 3 strings mit jeweils der Länge 6 angelegt.</p>
<p>Wieso geht das nicht.</p>
<pre><code class="language-cpp">arr[1]=&quot;Hallo&quot;;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2103257</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2103257</guid><dc:creator><![CDATA[blurry333]]></dc:creator><pubDate>Mon, 08 Aug 2011 07:46:41 GMT</pubDate></item><item><title><![CDATA[Reply to String on Mon, 08 Aug 2011 07:52:22 GMT]]></title><description><![CDATA[<p>weil mit &quot;Hallo&quot; nur ein temporärer String angelegt wird, der an einer fixen Adresse ist. arr[1] wird dann die Adresse dieses temporären Strings zugewiesen. Nach Zeilenende ist der temporäre Strings aber futsch. Und dann zeigt arr[1] auf Unsinn bzw. die Ausgabe ist oft richtig, weil der freigegebene Speicher noch nicht überschrieben worden ist, aber das Verhalten ist undefiniert.</p>
<p>Und für deinen Code gibt es auch noch Kompilierfehler. Sei froh, dass der das nicht zulässt!</p>
<p>Deswegen gibt es in C strcpy und in C++ die praktische Klasse string!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2103258</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2103258</guid><dc:creator><![CDATA[Eisflamme]]></dc:creator><pubDate>Mon, 08 Aug 2011 07:52:22 GMT</pubDate></item><item><title><![CDATA[Reply to String on Mon, 08 Aug 2011 07:52:11 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">char* andererString=&quot;Hallo&quot;;

arr[1]=andererString;
</code></pre>
<p>geht auch nicht oder ?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2103260</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2103260</guid><dc:creator><![CDATA[blurry333]]></dc:creator><pubDate>Mon, 08 Aug 2011 07:52:11 GMT</pubDate></item><item><title><![CDATA[Reply to String on Mon, 08 Aug 2011 08:09:39 GMT]]></title><description><![CDATA[<p>Na ja, das Problem an deinem [3][6] ist ja auch, dass die Zuweisung an ein char[6] nicht geht. Du kannst das gleiche als char* ausdrücken und dann hättest Du einen Zeiger auf den char-String. Aber für Stringkopien musst Du eben strcpy nutzen, da gibt es keine Ausnahme.</p>
<p>Auch:</p>
<pre><code class="language-cpp">char* andererString=&quot;Hallo&quot;;
</code></pre>
<p>macht keine Stringkopie. Du hast lediglich einen Zeiger auf die String-Konstante &quot;Hallo&quot; erstellt. Dann bleibt &quot;Hallo&quot; auch im Speicher irgendwo vertreten, da das eine ganz spezielle Initialisierung darstellt, aber Du kannst daran wiederum nichts ändern. Somit solltest du direkt <code>const char* andererString = &quot;Hallo&quot;;</code> schreiben, um das zu verdeutlichen.</p>
<p>Also ich versuche das Mal irgendwie zusammenzufassen:</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;

int main()
{
    const char* string = &quot;Ein konstanter String&quot;;
    char* string2 = &quot;Wieder ein konstanter String, denn ändern darfste nicht&quot;;
    char abc[3]; // ein String konstanter Länge von 3
    char* pointers[3]; // drei Zeiger auf Strings
    char** pointerPointers; // das kann man zu drei Strings machen oder auch zu einer beliebig großen Anzahl von Zeigern auf Strings; dafür ist dann aber new[] usw. nötig

    // Zum Initialisieren von String-Konstanten kann man die = &quot;...&quot;-Zuweisung nutzen; in allen anderen Fällen ist strcpy nötig
}
</code></pre>
<p>Und via std::string:</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;string&gt;

using namespace std;

int main()
{
    string threeStrings[3] = {&quot;Einer&quot;, &quot;Noch einer&quot;, &quot;Ein Dritter im Bunde&quot;};
    threeStrings[0] = &quot;Doch lieber ein anderer.&quot;;
    return 0;
}
</code></pre>
<p>Daher ist string eine tolle Klasse. Da hat man mit dem Speichergedöns viel weniger Probleme.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2103263</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2103263</guid><dc:creator><![CDATA[Eisflamme]]></dc:creator><pubDate>Mon, 08 Aug 2011 08:09:39 GMT</pubDate></item><item><title><![CDATA[Reply to String on Mon, 08 Aug 2011 11:35:09 GMT]]></title><description><![CDATA[<p>blurry333 schrieb:</p>
<blockquote>
<pre><code class="language-cpp">char arr[3][6]
</code></pre>
<p>ich habe 3 strings mit jeweils der Länge 6 angelegt.</p>
</blockquote>
<p>Je nach Definition von &quot;string&quot;.</p>
<p>blurry333 schrieb:</p>
<blockquote>
<p>Wieso geht das nicht.</p>
<pre><code class="language-cpp">arr[1]=&quot;Hallo&quot;;
</code></pre>
</blockquote>
<p>Es gibt keine Array-Zuweisung.</p>
<p>Eisflamme schrieb:</p>
<blockquote>
<p>weil mit &quot;Hallo&quot; nur ein temporärer String angelegt wird, [...] Nach Zeilenende ist der temporäre Strings aber futsch</p>
</blockquote>
<p>Da wird nichts temporär angelegt. String-Literale beziehen sich auf const-char-arrays mit statischer Lebenszeit.</p>
<p>Eisflamme schrieb:</p>
<blockquote>
<p>Und dann zeigt arr[1] auf Unsinn</p>
</blockquote>
<p>arr[1] ist kein Zeigerobjekt, welches eine Adresse speichert. arr[1] bezieht sich auf ein 6-elementiges char-Array. Das einzige, was arr[1] speichern kann, sind ein paar char-Werte. arr[1] kann man zwar in vielen Kontexten als Zeiger<strong>wert</strong> (also eine Adresse) verwenden. Aber die Adresse, die dabei rauskommt ist nicht änderbar.</p>
<p>Eisflamme schrieb:</p>
<blockquote>
<p>[...] gibt es in [...] C++ die praktische Klasse string!</p>
</blockquote>
<p>Die einzig vernünftige Bemerkung von Dir. Ich möchte &quot;praktisch&quot; nochmal betonen.</p>
<p>Ich schlage vor, ihr beide sucht mal nach ein paar der unzähligen Threads, in denen Zeiger, Arrays, Strings erklärt werden. Das wurde schon sehr oft durchgekaut, das Thema. Siehe zB hier:<br />
<a href="http://www.c-plusplus.net/forum/p1994728#1994728" rel="nofollow">http://www.c-plusplus.net/forum/p1994728#1994728</a></p>
<p>kk</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2103275</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2103275</guid><dc:creator><![CDATA[krümelkacker]]></dc:creator><pubDate>Mon, 08 Aug 2011 11:35:09 GMT</pubDate></item><item><title><![CDATA[Reply to String on Mon, 08 Aug 2011 10:04:31 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">void funk1(char* str)
void funk2(char** str)
</code></pre>
<p>Für mich sind beide obigen Deklarationen äquivalent. Gibt es irgendwann einen Unterschied.</p>
<pre><code class="language-cpp">char* mystring;

funk1(mystring);
funk2(&amp;mystring);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2103319</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2103319</guid><dc:creator><![CDATA[blurry333]]></dc:creator><pubDate>Mon, 08 Aug 2011 10:04:31 GMT</pubDate></item><item><title><![CDATA[Reply to String on Mon, 08 Aug 2011 10:16:27 GMT]]></title><description><![CDATA[<p>blurry333 schrieb:</p>
<blockquote>
<pre><code class="language-cpp">void funk1(char* str)
void funk2(char** str) // das *
</code></pre>
<p>Für mich sind beide obigen Deklarationen äquivalent. Gibt es irgendwann einen Unterschied.</p>
<pre><code class="language-cpp">char* mystring;

funk1(mystring);
funk2(&amp;mystring); //das &amp;
</code></pre>
</blockquote>
<p><img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2103327</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2103327</guid><dc:creator><![CDATA[Tachyon]]></dc:creator><pubDate>Mon, 08 Aug 2011 10:16:27 GMT</pubDate></item><item><title><![CDATA[Reply to String on Mon, 08 Aug 2011 11:37:00 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">int main(int arg,char** argv)
</code></pre>
<p>Wieso also char** argv und nicht char* argv ??</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2103367</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2103367</guid><dc:creator><![CDATA[blurry333]]></dc:creator><pubDate>Mon, 08 Aug 2011 11:37:00 GMT</pubDate></item><item><title><![CDATA[Reply to String on Mon, 08 Aug 2011 11:50:04 GMT]]></title><description><![CDATA[<p>Weils ein Array aus Strings ist?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2103378</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2103378</guid><dc:creator><![CDATA[314159265358979]]></dc:creator><pubDate>Mon, 08 Aug 2011 11:50:04 GMT</pubDate></item><item><title><![CDATA[Reply to String on Mon, 08 Aug 2011 11:57:39 GMT]]></title><description><![CDATA[<p>blurry333 schrieb:</p>
<blockquote>
<pre><code class="language-cpp">void funk1(char* str)
void funk2(char** str)
</code></pre>
<p>Für mich sind beide obigen Deklarationen äquivalent.</p>
</blockquote>
<p>Sind sie aber nicht. Abgesehen vom Namen und fehlenden Semikolons, deklariert die erste Zeile, was vom Typ her etwas anderes ist, als das, was die zweite Zeile deklariert.</p>
<p>blurry333 schrieb:</p>
<blockquote>
<p>Gibt es irgendwann einen Unterschied.</p>
</blockquote>
<p>Ich verstehe diesen Satz nicht.</p>
<p>blurry333 schrieb:</p>
<blockquote>
<pre><code class="language-cpp">char* mystring;

funk1(mystring);
funk2(&amp;mystring);
</code></pre>
</blockquote>
<p>Und was willst Du uns damit sagen?</p>
<p>blurry333 schrieb:</p>
<blockquote>
<pre><code class="language-cpp">int main(int arg,char** argv)
</code></pre>
<p>Wieso also char** argv und nicht char* argv ??</p>
</blockquote>
<p>Derjenige, der sich das ausgedacht hat, wollte nicht nur eine Zeichenkette, sondern beliebig viele Zeichenketten (argv[0], argv[1], ...) übergeben können.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2103383</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2103383</guid><dc:creator><![CDATA[krümelkacker]]></dc:creator><pubDate>Mon, 08 Aug 2011 11:57:39 GMT</pubDate></item><item><title><![CDATA[Reply to String on Mon, 08 Aug 2011 11:57:12 GMT]]></title><description><![CDATA[<p>blurry333 schrieb:</p>
<blockquote>
<pre><code class="language-cpp">int main(int arg,char** argv)
</code></pre>
<p>Wieso also char** argv und nicht char* argv ??</p>
</blockquote>
<p>Weil argv nicht nur auf ein einzelnes Zeichen oder eine einzelne Zeichenkette zeigt, sondern potentiell auf mehrere.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2103384</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2103384</guid><dc:creator><![CDATA[Tachyon]]></dc:creator><pubDate>Mon, 08 Aug 2011 11:57:12 GMT</pubDate></item><item><title><![CDATA[Reply to String on Mon, 08 Aug 2011 12:19:57 GMT]]></title><description><![CDATA[<p>Ja, tut mir Leid, da war einiges daneben. Aber ebenfalls vernünftig waren doch meine Hinweise, strcpy zu nutzen, um Strings zu kopieren, und dass all die ganzen Zuweisungen niemals Kopien machen. Egal, ist ja jetzt klar, danke.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2103394</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2103394</guid><dc:creator><![CDATA[Eisflamme]]></dc:creator><pubDate>Mon, 08 Aug 2011 12:19:57 GMT</pubDate></item><item><title><![CDATA[Reply to String on Mon, 08 Aug 2011 12:30:20 GMT]]></title><description><![CDATA[<p>meinst du mit mehreren Strings etwa sowas ?</p>
<pre><code class="language-cpp">char* array[5][];
</code></pre>
<p>ein Zeiger kann doch immer nur auf eine einzige Adresse zeigen ?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2103396</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2103396</guid><dc:creator><![CDATA[blurry333]]></dc:creator><pubDate>Mon, 08 Aug 2011 12:30:20 GMT</pubDate></item><item><title><![CDATA[Reply to String on Mon, 08 Aug 2011 12:40:04 GMT]]></title><description><![CDATA[<p>blurry333 schrieb:</p>
<blockquote>
<p>meinst du mit mehreren Strings etwa sowas ?</p>
<pre><code class="language-cpp">char* array[5][];
</code></pre>
<p>ein Zeiger kann doch immer nur auf eine einzige Adresse zeigen ?</p>
</blockquote>
<p><code>char**</code> ist ein Zeiger auf einen Zeiger. <code>charr**</code> zeigt auf den Anfang eines Arrays aus Zeigern. Und jeder Zeiger in diesem Array zeigt auf einen String.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2103401</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2103401</guid><dc:creator><![CDATA[Tachyon]]></dc:creator><pubDate>Mon, 08 Aug 2011 12:40:04 GMT</pubDate></item><item><title><![CDATA[Reply to String on Mon, 08 Aug 2011 14:07:33 GMT]]></title><description><![CDATA[<p>mein Compiler schluckt das problemlos.</p>
<pre><code class="language-cpp">void funk(char* x){}

//main
char* array[5][10];
funk(array);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2103447</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2103447</guid><dc:creator><![CDATA[blurry333]]></dc:creator><pubDate>Mon, 08 Aug 2011 14:07:33 GMT</pubDate></item><item><title><![CDATA[Reply to String on Mon, 08 Aug 2011 14:23:38 GMT]]></title><description><![CDATA[<p>blurry333 schrieb:</p>
<blockquote>
<p>mein Compiler schluckt das problemlos.</p>
<pre><code class="language-cpp">void funk(char* x){}

//main
char* array[5][10];
funk(array);
</code></pre>
</blockquote>
<p>Kompilierst Du das als C-Code?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2103459</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2103459</guid><dc:creator><![CDATA[Tachyon]]></dc:creator><pubDate>Mon, 08 Aug 2011 14:23:38 GMT</pubDate></item><item><title><![CDATA[Reply to String on Mon, 08 Aug 2011 14:36:06 GMT]]></title><description><![CDATA[<p>ja als C code mit Eclipse</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2103467</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2103467</guid><dc:creator><![CDATA[blurry333]]></dc:creator><pubDate>Mon, 08 Aug 2011 14:36:06 GMT</pubDate></item><item><title><![CDATA[Reply to String on Mon, 08 Aug 2011 14:37:48 GMT]]></title><description><![CDATA[<p>blurry333 schrieb:</p>
<blockquote>
<p>ja als C code mit Eclipse</p>
</blockquote>
<p>Und warum fragst Du im C++-Forum? Nach knapp 450 Posts sollte man wissen, welches Forum man benutzt...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2103471</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2103471</guid><dc:creator><![CDATA[Tachyon]]></dc:creator><pubDate>Mon, 08 Aug 2011 14:37:48 GMT</pubDate></item><item><title><![CDATA[Reply to String on Mon, 08 Aug 2011 15:13:16 GMT]]></title><description><![CDATA[<p>blurry333 schrieb:</p>
<blockquote>
<p>meinst du mit mehreren Strings etwa sowas ?</p>
<pre><code class="language-cpp">char* array[5][];
</code></pre>
</blockquote>
<p>Das ist kein C++ (auch kein C).</p>
<p>blurry333 schrieb:</p>
<blockquote>
<p>ein Zeiger kann doch immer nur auf eine einzige Adresse zeigen ?</p>
</blockquote>
<p>Eine Zeigervariable speichert höchstens eine Adresse, ja.</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;

using namespace std;

int main(int argc, char **argv)
{
  for (int i=0; i&lt;argc; ++i) {
    if (i&gt;0) std::cout &lt;&lt; ' ';
    std::cout &lt;&lt; argv[i];
  }
  std::cout &lt;&lt; std::endl;
}
</code></pre>
<p>Speicherlayout (Beispiel mit sizeof(char*)==4):</p>
<pre><code>Name:      argc        argv          argv[0] argv[1] argv[2]
Adresse:   egal        egal            152     156     160
         +-------+   +-------+      +-------+-------+-------+
Inhalt:  |   3   |   |  152  |      |  400  |  412  |  405  |
         +-------+   +-------+      +-------+-------+-------+

Adresse:  400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415
         +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
Inhalt:  | w | h | a | t |\0 | f | * | c | k | ? | ! |\0 | t | h | e |\0 |
         +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
</code></pre>
<p>Ausgabe:</p>
<pre><code>what the f*ck?!
</code></pre>
<p>Man beachte: argv zeigt nicht auf (den Anfang) eine(r) Zeichenkette.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2103491</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2103491</guid><dc:creator><![CDATA[krümelkacker]]></dc:creator><pubDate>Mon, 08 Aug 2011 15:13:16 GMT</pubDate></item><item><title><![CDATA[Reply to String on Wed, 24 Aug 2011 07:50:34 GMT]]></title><description><![CDATA[<p>[quote=&quot;krümelkacker&quot;]</p>
<p>blurry333 schrieb:</p>
<blockquote>
<p>Man beachte: argv zeigt nicht auf (den Anfang) eine(r) Zeichenkette.</p>
</blockquote>
<p>Da bekomm ich aber was anderes raus :</p>
<pre><code class="language-cpp">printf(&quot;Adresse in argv: %x\n&quot;,argv);

	printf(&quot;Adresse von argv[0]: %x&quot;,&amp;argv[0]);
</code></pre>
<p>Ausgabe:</p>
<p>Adresse in argv: 3e3c48<br />
Adresse von argv[0]: 3e3c48</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2109960</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2109960</guid><dc:creator><![CDATA[blurry333]]></dc:creator><pubDate>Wed, 24 Aug 2011 07:50:34 GMT</pubDate></item><item><title><![CDATA[Reply to String on Wed, 24 Aug 2011 08:44:24 GMT]]></title><description><![CDATA[<p>[quote=&quot;blurry333&quot;]</p>
<p>krümelkacker schrieb:</p>
<blockquote>
<p>blurry333 schrieb:</p>
<blockquote>
<p>Man beachte: argv zeigt nicht auf (den Anfang) eine(r) Zeichenkette.</p>
</blockquote>
<p>Da bekomm ich aber was anderes raus :</p>
<pre><code class="language-cpp">printf(&quot;Adresse in argv: %x\n&quot;,argv);

	printf(&quot;Adresse von argv[0]: %x&quot;,&amp;argv[0]);
</code></pre>
<p>Ausgabe:</p>
<p>Adresse in argv: 3e3c48<br />
Adresse von argv[0]: 3e3c48</p>
</blockquote>
<p>Ersteres gibt nicht die adresse von argv aus, sondern die vom inhalt von argv. Das zweite ebenfalls. &amp;argv ist die adresse von argv, weder argv noch &amp;argv[0]</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2109980</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2109980</guid><dc:creator><![CDATA[Cachus]]></dc:creator><pubDate>Wed, 24 Aug 2011 08:44:24 GMT</pubDate></item><item><title><![CDATA[Reply to String on Wed, 24 Aug 2011 08:46:12 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">printf(&quot;Adresse in argv: %x -&gt; %x\n&quot;,*argv, argv);
printf(&quot;Adresse von argv[0]: %x\n&quot;,&amp;argv[0]);
printf(&quot;Adresse von argv[1]: %x&quot;,&amp;argv[1]);
</code></pre>
<pre><code>Adresse in argv: 3e2441 -&gt; 3e24c8
Adresse von argv[0]: 3e24c8
Adresse von argv[1]: 3e24cc
</code></pre>
<p>greetz KN4CK3R</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2109982</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2109982</guid><dc:creator><![CDATA[KN4CK3R]]></dc:creator><pubDate>Wed, 24 Aug 2011 08:46:12 GMT</pubDate></item><item><title><![CDATA[Reply to String on Wed, 24 Aug 2011 11:37:44 GMT]]></title><description><![CDATA[<p>blurry333 schrieb:</p>
<blockquote>
<p>krümelkacker schrieb:</p>
<blockquote>
<p>Man beachte: argv zeigt nicht auf (den Anfang) eine(r) Zeichenkette.</p>
</blockquote>
<p>Da bekomm ich aber was anderes raus :</p>
<pre><code class="language-cpp">printf(&quot;Adresse in argv: %x\n&quot;,argv);
  printf(&quot;Adresse von argv[0]: %x&quot;,&amp;argv[0]);
</code></pre>
<p>Ausgabe:</p>
<p>Adresse in argv: 3e3c48<br />
Adresse von argv[0]: 3e3c48</p>
</blockquote>
<p>Das klingt so, als würdest Du glauben, hier einen Widerspruch aufgezeigt zu haben. Dem ist nicht so. zeiger==&amp;zeiger[0] ist immer wahr (Tautologie), <strong>unabhängig</strong> davon, wohin der Zeiger zeigt. Der Standard definiert zeiger[index] äquivalent zu *(zeiger+index). &amp;zeiger[0] ist daher äquivalent zu &amp;*zeiger, wobei sich &amp; und * quasi wegkürzen.</p>
<p>Cachus schrieb:</p>
<blockquote>
<p>Ersteres gibt nicht die adresse von argv aus, sondern die vom inhalt von argv.</p>
</blockquote>
<p>Die Adresse von argv ist eigentlich noch weniger interessant.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2110060</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2110060</guid><dc:creator><![CDATA[krümelkacker]]></dc:creator><pubDate>Wed, 24 Aug 2011 11:37:44 GMT</pubDate></item></channel></rss>