<?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[Anfängerfehler: Doppelzeiger]]></title><description><![CDATA[<p>Sorry, ich hab keine Ahnung, wie ich das folgende zum Laufen bringen kann. Dabei will ich nur eine Funktion schreiben, die eine Matrix zurückliefert:</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;cmath&gt;

using namespace std;

double** foo() {
  double matrix[10][3];

  for(int i = 0; i &lt; 10; i++)
  for(int j = 0; j &lt; 3; j++)
  {
     matrix[i][j] = 87*i+26*j;
  }
  return matrix;
}

int main()
{
  double** matrix = foo();
  return 0;
}
</code></pre>
<p>Bin für sachdienliche Hinweise sehr dankbar.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/126366/anfängerfehler-doppelzeiger</link><generator>RSS for Node</generator><lastBuildDate>Mon, 24 Aug 2026 15:56:39 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/126366.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 14 Nov 2005 17:03:33 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Anfängerfehler: Doppelzeiger on Mon, 14 Nov 2005 17:03:33 GMT]]></title><description><![CDATA[<p>Sorry, ich hab keine Ahnung, wie ich das folgende zum Laufen bringen kann. Dabei will ich nur eine Funktion schreiben, die eine Matrix zurückliefert:</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;cmath&gt;

using namespace std;

double** foo() {
  double matrix[10][3];

  for(int i = 0; i &lt; 10; i++)
  for(int j = 0; j &lt; 3; j++)
  {
     matrix[i][j] = 87*i+26*j;
  }
  return matrix;
}

int main()
{
  double** matrix = foo();
  return 0;
}
</code></pre>
<p>Bin für sachdienliche Hinweise sehr dankbar.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/917551</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/917551</guid><dc:creator><![CDATA[MatthiasK]]></dc:creator><pubDate>Mon, 14 Nov 2005 17:03:33 GMT</pubDate></item><item><title><![CDATA[Reply to Anfängerfehler: Doppelzeiger on Mon, 14 Nov 2005 17:08:08 GMT]]></title><description><![CDATA[<p>So, wie das dort ist, kann es nicht funktionieren, weil du einen Zeiger auf ein lokales Objekt der Funktion zurücklieferst. Du müsstest den Speicher dynamisch in einer Schleife alloziieren und später im Programm wieder freigeben. Mehrdimensionale Arrays sind aber generell irgendwie ne komische Sache, machen nur Ärger.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/917562</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/917562</guid><dc:creator><![CDATA[.filmor]]></dc:creator><pubDate>Mon, 14 Nov 2005 17:08:08 GMT</pubDate></item><item><title><![CDATA[Reply to Anfängerfehler: Doppelzeiger on Mon, 14 Nov 2005 17:34:36 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/10490">@MatthiasK</a>: Außerdem ist (wie von Hume heute schon einmal erklärt) ein Ein Zeiger auf das erste element eines Zweidimensonalen Arrays vom Typ T kein T** sondern ein (*)[x], wobei x die zweite Dimension angibt. Siehe dazu auch in der C++FAQ... (multidimensionale Arrays o.ä.)</p>
<p>Gruß Caipi</p>
]]></description><link>https://www.c-plusplus.net/forum/post/917589</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/917589</guid><dc:creator><![CDATA[Caipi]]></dc:creator><pubDate>Mon, 14 Nov 2005 17:34:36 GMT</pubDate></item></channel></rss>